I already have my site built in Rails, and this is just a re-code in Django. I've had really good luck with it until now :) You can see the desired output (although the markup is different) at http://www.btaylordesign.com/portfolio
On Mar 29, 12:47 am, Brandon Taylor <[EMAIL PROTECTED]> wrote: > What I would like to accomplish is output that looks as such: > > <h3>Category name</h3> > <ul> > <li>Sample Name</li> > <li>Sample Name</li> > <li>Sample Name</li> > </ul> > > <h3>Category name</h3> > <ul> > <li>Sample Name</li> > <li>Sample Name</li> > <li>Sample Name</li> > </ul> > > (repeat) > > So, it made sense to me to start with the categories and loop through > the children for each category. Is my thinking way off for the way the > template system is designed? Thanks for your help, I really appreciate > your time. > > On Mar 29, 12:43 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > > 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 > > kghttp://lawgon.livejournal.comhttp://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 -~----------~----~----~----~------~----~------~--~---