On Tue, Dec 21, 2010 at 9:48 PM, Dopster wrote:
> Let's say I have the following models:
>
> class Group(models.Model):
> group_name = models.CharField(max_length=20)
>
> class Person(models.Model):
> group = models.ForeignKey(Group)
> name = models.CharField(max_length=50)
>
> How do
in the view:
persons = Person.objects.all().order_by('group')
in the template:
{% for p in persons %}
{% ifchanged p.group %}
{{p.group}}:
{%endifchanged%}
{{p.name}}
{% endfor %}
--
Javier
--
You received this message because you are subscribed to the Google Groups
"Django users
Let's say I have the following models:
class Group(models.Model):
group_name = models.CharField(max_length=20)
class Person(models.Model):
group = models.ForeignKey(Group)
name = models.CharField(max_length=50)
How do I get an output of the following?
GroupA: John, Stacy, Pete
Group
3 matches
Mail list logo