Currently using Django version 0.96.3, on a Fedora 8 system.

I've currently set-up models for 'Manufacturer' and 'System'. System
has a Foreignkey to Manufacturer.

I'd like to display a list like so:

Manu A
   System a
   System b
   System c

Manu B
   System a
   System b
   System c

Etc...

Only listing Manufacturers that had systems of type X.

I was thinking of using code like this in the View,

 man=Manufacturer.objects.all()
>>> for m in man:
...    sys=System.objects.filter(manufacturer=m.id)
...    print m.name
...    for s in sys:
...       print "  %s" % s.name
...

This works from the shell, but I'm unsure how to get the output to the
template And, I suspect is a terribly inefficient way to do it anyway.

I'm guessing I should be doing something simpler here and then doing
something in the template to form the list....

Any help appreciated, including severe beatings with a clue stick. ;)

This is only my 2nd attempt at a Django project, and I'm stumped at
the moment.

Thanks,

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