Necmettin Begiter wrote: > Hello all, > > I have, say, 8 tables: Persons, works, phones, emails, addresses, > eaddresses, articles, books. > > Each one may have relationship with another one, like so: > > A person may have more than one work, phone, email, address, eaddress, > article and book. > A phone, email, address, eaddress, .. may be related to more than one > persons. > > So, here is a sample model: > > class Relations(models.Model): > srctbl = models.CharField(max_length=2, choices=TBL_CHOICES) > srcidx = models.IntegerField() > tgttbl = models.CharField(max_length=2, choices=TBL_CHOICES) > tgtidx = models.IntegerField() > > But there's a *slight* problem here. Possible values for *idx fields > must change when *tbl are changed, like so: > > If I select Person for srctbl, srcidx must contain names of possible > persons; if I select Phone for srctbl, srcidx must contain possible > phone numbers. And this is the same for tgt* fields. I have been looking > around Django Docs and references for a while now, but couldn't come > with a solution. IntegerField()s must actually be like ForeignKey(Person > or Phone or Email or Address or eAddress) .. Any ideas on how to achieve > this?
Why aren't you using ManyToManyField's? It sounds like that's what you're trying to emulate ;) Regards, Christian -- Christian Joergensen http://www.technobabble.dk --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---