Skip to content

Commit

Permalink
Create member foreign key in failed_payment
Browse files Browse the repository at this point in the history
  • Loading branch information
SamWinterhalder committed Mar 28, 2021
1 parent b6536bf commit 2c45a15
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions memberships/migrations/0009_auto_20210323_1611.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 3.1.7 on 2021-03-23 16:11

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('memberships', '0008_member_renewal_date'),
]

operations = [
migrations.RemoveField(
model_name='failedpayment',
name='stripe_customer_id',
),
migrations.AddField(
model_name='failedpayment',
name='member',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='memberships.member'),
),
migrations.AlterField(
model_name='member',
name='stripe_customer_id',
field=models.CharField(max_length=255, unique=True),
),
]
4 changes: 2 additions & 2 deletions memberships/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Member(models.Model):
constitution_agreed = models.BooleanField(
help_text='I have read and agree to abide by the <a href="http://geek.zone/constitution">Geek.Zone/Constitution</a>.'
)
stripe_customer_id = models.CharField(max_length=255)
stripe_customer_id = models.CharField(max_length=255, unique=True)
user = models.OneToOneField(User, on_delete=models.CASCADE)
profile_image = models.ImageField(
upload_to="images/",
Expand Down Expand Up @@ -141,7 +141,7 @@ class Membership(models.Model):


class FailedPayment(models.Model):
stripe_customer_id = models.CharField(max_length=255)
member = models.ForeignKey(Member, on_delete=models.CASCADE)
stripe_subscription_id = models.CharField(max_length=255)
stripe_event_type = models.CharField(max_length=255)

Expand Down

0 comments on commit 2c45a15

Please sign in to comment.