Is there a group_by method when getting querysets? Check out the following example.
class SportsEvent(models.Model): """Sports""" name = models.CharField(max_length=255) sport_type = models.ForeignKey(Sport) event_date = models.DateTimeField() class Sport(models.Modle): """sports""" sport_name = models.CharField(max_length=255) so I would like to be able to do something like this: 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 Football ------------ January 10 February 16 June 21 and so on... Does django carry something similar to what I am looking for? If not, would a group_by feature be something worth adding to django? Thanks in Advance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---