From 721472b416c473c37c9a20c28d76ce38073d910e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 21 Jun 2020 14:45:05 +0200 Subject: [PATCH] Fix constraint to active = True --- uncloud_pay/migrations/0001_initial.py | 2 +- uncloud_pay/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/uncloud_pay/migrations/0001_initial.py b/uncloud_pay/migrations/0001_initial.py index faa4b26..0be384a 100644 --- a/uncloud_pay/migrations/0001_initial.py +++ b/uncloud_pay/migrations/0001_initial.py @@ -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'), ), ] diff --git a/uncloud_pay/models.py b/uncloud_pay/models.py index 08b9b21..9ad005b 100644 --- a/uncloud_pay/models.py +++ b/uncloud_pay/models.py @@ -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') ]