Let's say I have: class Restaurant(Model): pass
class Table(Model) restaurant = ForeignKey(Restaurant) class Chair(Model) restaurant = ForeignKey(Restaurant) table = ForeignKey(Table) Is there a best practice for ensuring that the chair assigned to a table is always from the same restaurant? These models above assume that we might have spare chairs not yet assigned to tables. My actual case is more like this: class A(Model): pass class B(Model): a = ForeignKey(A) class C(Model): a = ForeignKey(A) class D(Model): b = ForeignKey(B) c = ForeignKey(C) And I want to ensure b.a == c.a. (I think I just have to manually add db sql constraints in my migrations and also override save()) Are there any well supported / used django packages to manage this for me? This https://github.com/rapilabs/django-db-constraints looks promising, but is awfully quiet. Rich -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/eea28a8f-4a73-4f74-a182-d6ade68a6737%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

