Re: get many from multiple levels of one-to-many relations

2006-07-19 Thread Corey Oordt
Thanks, Andy. I'll give that a try! Corey On Jul 18, 2006, at 9:35 PM, Andrew wrote: > > Here's how I did it for a similar situation I had. > > class MyCategory(models.Model): > category = models.CharField(maxlength=50) > parent_category = models.ForeignKey('self', blank=True, >

Re: get many from multiple levels of one-to-many relations

2006-07-18 Thread Andrew
Here's how I did it for a similar situation I had. class MyCategory(models.Model): category = models.CharField(maxlength=50) parent_category = models.ForeignKey('self', blank=True, null=True, related_name='sub_categories') def all_items(self): data = list(self.ite

get many from multiple levels of one-to-many relations

2006-07-18 Thread Corey
I have three tables: pubs, routes, and addresses, there is a hierarchical relation ship between them: one pub has many routes which in turn has many addresses. Simplified models: class Publication(models.Model): code = models.CharField(blank=True, maxlength=10, unique=True) name = model