[Answered ]-Django โ€“ How to show Full name of the Month in Django Admin Panel

1๐Ÿ‘

โœ…

I found out that due_date field cannot be overriden with the same function name. I have to change it to different function name, and put description and django admin default filter functionality manually back

admin.py

@admin.register(Todo)
class AdminTodo(admin.ModelAdmin):  
    list_display = ('id','title','admin_due_date',)
    list_display_links = ('title',)

    # display table header as due_date instead of admin_due_date
    @admin.display(description='due_date')
    def admin_due_date(self,obj):
       return obj.due_date.strftime("%d %B %Y")

    # set django admin filter functionality back
    admin_due_date.admin_order_field = 'due_date'
๐Ÿ‘คflyingduck92

Leave a comment