aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/payments/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyblackbird_cc/payments/models.py')
-rw-r--r--pyblackbird_cc/payments/models.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pyblackbird_cc/payments/models.py b/pyblackbird_cc/payments/models.py
index cbf462c..174e3fe 100644
--- a/pyblackbird_cc/payments/models.py
+++ b/pyblackbird_cc/payments/models.py
@@ -57,5 +57,8 @@ class Subscription(models.Model):
start_date = models.DateTimeField(null=True, blank=True)
end_date = models.DateTimeField(null=True, blank=True)
+ class Meta:
+ constraints = [models.UniqueConstraint(fields=["user", "plan"], name="unique_user_plan")]
+
def __str__(self):
return f"Subscription for {self.user.username}"