I have a Company class. A Company has many Clients, each of which is
also a Company. The problem I have is that in the auto-generated Admin
site, the Clients show up as a multi-select with the Company in the
select box. This doesn't make sense, because a company can't select
itself as a client.

So, how do I specify in the model that the company should not show up
in its list of clients?

I tried to do it by saying the client id should not equal the parent
company id. But I don't seem to be able to get the syntax right.

Can anyone shed light on this? Thanks.

---

class Company(models.Model):
        name                 = models.CharField(max_length=128)
        main_phone_number    = models.CharField
(max_length=64,blank=True,null=True)
        main_email_address   = models.EmailField(blank=True,null=True)
        url                  = models.URLField(blank=True,null=True)
        clients              = models.ManyToManyField
('self',blank=True,null=True,limit_choices_to={'id__ne':'id'})

        def __unicode__(self):
                return u'%s' % self.name

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to