Monday, May 3, 2010

Distinct Field

Hi everybody,

I have a model called "Project" with the field "year". I have
something about 1200 rows all of them with the year value "2010". But,
I'll start adding projects for other years.

I want to show the years that has projects, now it should just be:
2010

I am trying to do this:
p = Project.objects.values('year').distinct()
But it returns me 1200 rows! How should I do to just get one row for
each year in the table?

Thanks!

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate