6👍
✅
You can add a method to the ModelAdmin
class.
@admin.register(YourModel)
class YourModelAdmin(admin.ModelAdmin):
list_display = ('get_date_formatted',)
def get_date_formatted(self, obj):
if obj:
return obj.date.date()
get_date_formatted.admin_order_field = 'date'
get_date_formatted.short_description = 'date'
Source:stackexchange.com