A simplified version of model is this:

class Category(models.Model):
        category = models.CharField(maxlength=100)

class Program(models.Model):
        name = models.CharField(maxlength=100)
        category = models.ForeignKey(Category)

class Message(models.Model):
        program = models.ForeignKey(Program)
        msgstr = models.TextField(null=True)

My question is if I have a list of Message objects how can I regroup
them based on their programs category?

Is there a way to look through the relationships and do this?

Obviously,
{% regroup messages by messages.program.category as grouped %}

doesn't work.  Any thoughts?


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