In the Django admin site, how do I change the display format of time fields?

前端 未结 4 803
萌比男神i
萌比男神i 2020-12-13 13:57

I recently added a new model to my site, and I\'m using an admin.py file to specify exactly how I want it to appear in the admin site. It works great, but I can\'t figure ou

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 14:45

    If you've tried gabriel's answer but it did not work, try to set USE_L10N = False in settings.py, it works for me.

    Note that if USE_L10N is set to True, then the locale-dictated format has higher precedence and will be applied instead

    See: https://docs.djangoproject.com/en/2.0/ref/settings/#std:setting-DATETIME_FORMAT

提交回复
热议问题