0

For Django, I have this in my model: date = models.DateTimeField()

the widget for this is AdminSplitDateTime in the Admin Panel.

It then displays a graphical widget that shows the date and time, and allows you to pick today or now.

What I want to do instead is just display the date time as a string, as such:

Date: 08/26/2021 04:46:11 PM

I just want to display the date/time as text rather than a fancy widget...

I spent time trying to figure this out, but I am stuck. Do you guys have any idea on how to implement this in Django? Thanks!

Erik343
  • 323
  • 4
  • 14
  • Potential duplicate of https://stackoverflow.com/questions/3469979/django-admin-overriding-the-widget-of-a-custom-form-field You can set formfield overrides, and set the widget for the field. In this case you will want to use the `admin.widgets.AdminTextInputWidget` – iri Aug 27 '21 at 00:01
  • ok thanks for that info, but how do I specify the date format? like dd-mmm-yyyy hh:mm ? – Erik343 Aug 27 '21 at 00:10

0 Answers0