If I correctly understand you issue is to get part of the date for each
item in a list of datetime.datetime or datetime.date objects.
To do this you can process the list after the query
new_list = [item.year for item in item]
But if your need is to extract fields from the objects in the result
Hi guy.
so, A don't is understand very well.
but the django has the generic date views, I think is exactly this.
https://docs.djangoproject.com/en/dev/ref/class-based-views/generic-date-based/#module-django.views.generic.dates
2014-05-27 9:06 GMT+01:00 hito koto :
>
Hi,
I want to get only year and get only month,
i want to get the only : 2005 and 05-27
How can i to do?
I know this :
>>> Entry.objects.dates('pub_date', 'year')[datetime.date(2005, 1, 1)]>>>
>>> Entry.objects.dates('pub_date', 'month')[datetime.date(2005, 2, 1),
>>> datetime.date(2005,
3 matches
Mail list logo