#34241: Django admin not showing seconds for list_display nor readonly
DateTimeField
-------------------------------+--------------------------------------
Reporter: Petr DlouhĂ˝ | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 4.1
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):
* cc: Carlton Gibson (added)
Comment:
> More importantly the seconds might be very important even for many
ordinary admin users. There might be several use-cases.
Agreed, but it's not something all users need for all dates.
> ... or at least make it possible to easily configure the output data
format in admin interface without need to change it systemwide.
You can always change format for a single field, e.g
{{{#!python
class MyModelAdmin(admin.ModelAdmin):
@admin.display(description="Created with seconds")
def custom_created(self, obj):
return obj.created.strftime("d M. Y H:i:s")
list_display = (..., "custom_created")
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34241#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018586aae0d2-be06bb62-e2f8-4702-9f22-5ba1e6fd297a-000000%40eu-central-1.amazonses.com.