django template date formatting -


normally default date formats work correctly in templates, reason on project i'm having trouble getting default date formats work, formatting datetime in templates. want date times show default listed on https://docs.djangoproject.com/en/1.6/ref/settings/, it's showing in format: 2014-08-18t19:08:49.138282

not default format not working, can't use built-in date template filter. when use it, nothing returns.

i'm using python 3.4 , django 1.6.5

here relevant code:

### models.py ### class post(models.model):     ...     create_date = models.datetimefield(auto_now_add=true)     ...   ### settings.py ### language_code = 'en-us' use_l10n = true # adding following line doesn't change datetime default datetime_format = 'n j, y, p'  ### template.html ### {{ post }} <!-- correctly returns post object view --> {{ post.create_date }} <!-- returns datetime, horrible format --> {{ post.create_date|date }} <!-- returns nothing -->  {{ post.create_date|date:"n j, y, p" }} <!-- returns nothing --> 

i've looked @ many posts regarding topic haven't foundthe answer. django docs prior experience indicate should working. what's missing? ideas?

there missing information in question. post object coming tastypie api call, , not treat date/datetime same django orm default.

i ended switching use normal django orm, option tastypie datetime can modified tastypie_datetime_formatting setting http://django-tastypie.readthedocs.org/en/latest/serialization.html


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -