Skip to content

Show seconds for datetime fields in the admin - #526

Open
GiannopoulosK wants to merge 1 commit into
celery:mainfrom
GiannopoulosK:admin-datetime-seconds
Open

GiannopoulosK wants to merge 1 commit into
celery:mainfrom
GiannopoulosK:admin-datetime-seconds

Conversation

@GiannopoulosK

Copy link
Copy Markdown

Closes #403

Django's default datetime format drops the seconds, which makes tasks that ran close together hard to tell apart. This shows the date fields as Y-m-d H:i:s (in the active timezone) in the task and group result admins, both in the list views and on the detail pages.

  • Columns keep their existing labels and still sort by the underlying field; date_hierarchy and list_filter are unchanged.
  • The raw date fields stay in TaskResultAdmin.readonly_fields, so subclasses whose fieldsets still name them keep working with ALLOW_EDITS.
  • The format is a single constant (DATETIME_DISPLAY_FORMAT) if a different one is preferred.

Tests cover the formatting, timezone handling, sorting, both admins' list/detail pages, and the subclass case.

Display the created, started and completed datetimes as Y-m-d H:i:s in the task and group result admins. Columns keep their labels and still sort by the underlying field.

Closes celery#403
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display the seconds of the datetime fields in the django admin

1 participant