On 29-Mar-08, at 10:52 AM, Brandon Taylor wrote:

> So, to simplify my question, how can I access the child objects of a
> 'work_category' through the nested for loop, given my model structure?

each WorkSample will have one work_category which you can access like  
this:

worksamples = WorkSample.objects.all()
for sample in worksamples:
     show worksamples.work_category

if you want all the WorkSamples that reference a particular  
work_catgory then you do:

wc = WorkCategory.objects.get(pk=id)
samples = wc.work_category_set.all()

and you can loop through the samples. I hope this helps

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




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