Friday, February 25, 2011

how to get the time from date-based generic views

Suppose we have a django page using
django.views.generic.date_based.object_detail (or even archive_index..
actually doesn't really matter...)

In the model class I saved the datetime.datetime.now which suppose to
include the day, month, year, and time.

But I have no idea how to access the time part when i am using this
generic views

What I want is Feb 26, 2011, 01:12:04 AM
I can get the calendar part by {{ object.pub_date}}

How do I get the time part?


For example, in urls.py

entry_info_dict = {
'queryset': Entry.publish.all(),
'date_field': 'pub_date',
}

Here's the doc for quick access
http://docs.djangoproject.com/en/dev/ref/class-based-views/#date-based-views

Thank you guys.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment