Got it sorted now thanks ...

Mike

On 5/01/2012 2:55pm, Mike Dewhirst wrote:
How should I do this?

Obj-1 <---[n:M]---> Obj-2

Obj-1 is in one table and Obj-2 is in a different table.

The business rule is that a relationship must exist between two
companies before there can be a link between Obj-1 and Obj-2. One
company owns Obj-1 and the other company needs access to it via Obj-2.

I can't think of any other way than to put two FKs to the Company table
in Obj-2 and prevent Obj-2 being saved (raise a business integrity
error) if there isn't a pre-existing relationship between the two
companies. There is a Relationship table with one record for each pair
of companies.

If this is a reasonable thing to do?

If so how would I tackle that in the save() method of Obj-2?

Thanks for any ideas and pointers

Mike





--
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