# May contain several purchases
class Transaction(models.Model):
    name = models.CharField(null=True)

class Purchase(models.Model):
    bundle = models.ForeignKey(Transaction, null=True)
    recurring = models.BooleanField(default=False)

For a given transaction, all its purchases must either all be recurring
 or all non-recurring.

What is the best way to check it (and throw an exception if in a
transaction there are both non-recurring and recurring purchases)?

-- 
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/1487113329.20585.1.camel%40narod.ru.
For more options, visit https://groups.google.com/d/optout.

Reply via email to