On May 9, 1:47 pm, Chris <[EMAIL PROTECTED]> wrote:
> Is there a group_by method when getting querysets?

Nope... nothing of the sort. You'll have to write raw SQL for that.
I'm struggling with the same thing right now.

> Check out the following example.
> ...
> events_by_group =
> SportsEvent.objects.group_by("sport_type").order_by("event_date")
>
> and hopefully get something like this:
>
> [<object_group1>, <object_group2>, <object_group3>,]
>
> and each <object_group> would contain SportsEvents objects.
> [<grouped_objects1>, <grouped_objects2>, .... ]
>
> so...
>
> Basketball
> -----------------
> January 2
> March 8
> May 10

I'd like that, too.

> Does django carry something similar to what I am looking for? If not,
> would a group_by feature be something worth adding to django?

Something like it is being "considered" but nothing for sure:
http://code.djangoproject.com/ticket/3566


Greg
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to