There is a way to get it I know there is but I cant see the wood for the
trees
There are 2 areas each with the same name but belonging to the same
PracticeCategory
Practice categories are Individual and Business
There is a practicetype called Property that belongs to Individual (1) 
There is a practicetype called Property that belongs to Business (2)

Awkward I know but trust me this is the 4th goalpost change in as many weeks

Models excerpts

PracticeCategory
PracticeType - category = models.ForeignKey(PracticeCategory)
Partner - area = models.ManyToManyField(PracticeType)

View excerpt

def pracpart(request, id):
    this = PracticeCategory.objects.all().order_by('priority',)
    practice = PracticeType.objects.filter(pk=id)
    for p in practice:
        partner_list = p.partner_set.all()

Template excerpt
{% for p in partner_list %}
{% for a in p.area.all %}{{ a.practice }}, {% endfor %}

Now this outputs correctly all the areas in which a partner practices BUT
becasue of the same name/title requirement of the practicearea it repeats
itself as Property, Property so what I want to do is either

limit the result of  {% for a in p.area.all %} to only PracticeCategory 1
(Individual) or
group the result set by the PracticeCategory  --- The regroup would be
neater but I'd be happy just to get an output by PracticeCategory 1
(Individual)

Cheers
-- 
View this message in context: 
http://old.nabble.com/reverse-or-selected_related-or--tp31334219p31334219.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to