Fix constraint to active = True

This commit is contained in:
Nico Schottelius 2020-06-21 14:45:05 +02:00
parent 424ceafbb8
commit 721472b416
2 changed files with 2 additions and 2 deletions

View file

@ -135,6 +135,6 @@ class Migration(migrations.Migration):
),
migrations.AddConstraint(
model_name='billingaddress',
constraint=models.UniqueConstraint(condition=models.Q(primary=True), fields=('owner',), name='one_active_billing_address_per_user'),
constraint=models.UniqueConstraint(condition=models.Q(active=True), fields=('owner',), name='one_active_billing_address_per_user'),
),
]

View file

@ -208,7 +208,7 @@ class BillingAddress(models.Model):
class Meta:
constraints = [
models.UniqueConstraint(fields=['owner'],
condition=Q(primary=True),
condition=Q(active=True),
name='one_active_billing_address_per_user')
]