bluszcz
bluszcz

Reputation: 4128

Default format of date

I know about Django filter "date" which allows to format date in templates.

I know that I can modify representation of particular field in particular model.

But when I have big Django project and would like to keep format of date to show in template in consistent way - is there any possibility to achieve this with settings? If not, other possibilities?

The easiest solution which comes to my mind is to write own templatetag to show date and use it, but maybe is something obvious which I missed.

And It would be nice if this date of format could vary depends on locales...

Upvotes: 2

Views: 917

Answers (1)

arie
arie

Reputation: 18982

Make sure to check the settings that affect the representation of dates.

Especially DATE_FORMAT

The default formatting to use for displaying date fields in any part of the system

and DATETIME_FORMAT

The default formatting to use for displaying datetime fields in any part of the system. Note that if USE_L10N is set to True, then the locale-dictated format has higher precedence and will be applied instead

Upvotes: 3

Related Questions