Thanks.. I think that will work.. will try it out shortly!
On Oct 8, 11:08 am, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> I have a model class 'Organization' with a parent and I do this with a
> method get_child_orgs:
>
> get_child_orgs(self):
> child_orgs = []
> co = Organization.object
I have a model class 'Organization' with a parent and I do this with a
method get_child_orgs:
get_child_orgs(self):
child_orgs = []
co = Organization.objects.filter(parent__exact = self)
for c in co:
child_orgs.append(c)
gc = c.get_child_orgs()
child_orgs.extend
Am Montag, 8. Oktober 2007 15:13 schrieb [EMAIL PROTECTED]:
> In my model class I have:
>
> class Company(models.Model):
> company_id = models.AutoField(primary_key=True)
> parent_company = models.ForeignKey("self",null=True)
> .
> .
>
>
> How would I query to get back all children
On Mon, 2007-10-08 at 13:31 +, [EMAIL PROTECTED] wrote:
> Ok..thanks.. I was afraid I was going to get that answer. If I do
> this with select_related, I'm still going to have to implement a loop
> to display them all in one list, because they'd come back as
> company.parent_company.parent_co
Ok..thanks.. I was afraid I was going to get that answer. If I do
this with select_related, I'm still going to have to implement a loop
to display them all in one list, because they'd come back as
company.parent_company.parent_company etc, instead of all in one top
level list... right?
On Oct 8
On Mon, 2007-10-08 at 13:13 +, [EMAIL PROTECTED] wrote:
> In my model class I have:
>
> class Company(models.Model):
> company_id = models.AutoField(primary_key=True)
> parent_company = models.ForeignKey("self",null=True)
> .
> .
>
>
> How would I query to get back all child
In my model class I have:
class Company(models.Model):
company_id = models.AutoField(primary_key=True)
parent_company = models.ForeignKey("self",null=True)
.
.
How would I query to get back all children companies, as well as all
of their children companies, and their children co
7 matches
Mail list logo