Forked from bee-keeper/Month year only in django dateField 
          
        
    
          Created
          April 5, 2023 01:07 
        
      - 
      
 - 
        
Save flyingduck92/f18d6b62a3820e1c19ba135d5b4b1cf4 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
bee-keeper created this gist
Aug 20, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #models.py class SomeClass(models.Model): date = models.DateField() #forms.py date = forms.DateField(widget=MonthYearWidget) # Get widget here -> https://djangosnippets.org/snippets/1688/ #admin.py class SomeClassAdmin(admin.ModelAdmin): list_display = ('format_date',) def format_date(self, obj): return obj.date.strftime('%b, %Y') format_date.admin_order_field = 'date' format_date.short_description = 'Date' admin.site.register(SomeClass, SomeClassAdmin)