wizard, Would it make sense to use the intermediate table to hold the field?
Using the stack overflow example: class Edi856(models.Model): pass class Order(models.Model): edi = models.ManyToManyField(Edi856, through='PoNum') def in_edi(self): '''Has the edi been processed?''' return self.edi.all().count() class PoNum(models.Model): order = models.ForeignKey(Order) edi = models.ForeignKey(Edi856) po_num = models.CharField(max_length=90, db_index=True ) The save route also sounds ok, a pre_save signal could also work. On Wed, Apr 14, 2010 at 5:19 AM, wizard <wiz...@roborooter.com> wrote: > This is sort of an extension of my post from stackoverflow. > > http://stackoverflow.com/questions/2632573/how-do-i-relate-two-models-tables-in-django-based-on-non-primary-non-unique-keys > > The gist is I have two tables with a common field and I would like to > relate two models with a many to many based off of this field. > > As far as I can tell I have to build the relations manually. I was > thinking of overriding the save method in both models to query the > other table and rebuild the relation on save. > > Does this sound rational? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- ======================================= 株式会社ビープラウド イアン・ルイス 〒150-0021 東京都渋谷区恵比寿西2-3-2 NSビル6階 email: ianmle...@beproud.jp TEL:03-6416-9836 FAX:03-6416-9837 http://www.beproud.jp/ ======================================= -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.