Skip to content

Commit e371caf

Browse files
committed
Make next_bill_date nullable
Next bill date can be null if a subscription != active
1 parent 444dbdc commit e371caf

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.0.5 on 2020-04-10 00:56
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('djpaddle', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='subscription',
15+
name='next_bill_date',
16+
field=models.DateTimeField(blank=True, null=True),
17+
),
18+
]

djpaddle/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ class Subscription(PaddleBaseModel):
141141
email = models.EmailField()
142142
event_time = models.DateTimeField()
143143
marketing_consent = models.BooleanField()
144-
next_bill_date = models.DateTimeField()
144+
next_bill_date = models.DateTimeField(
145+
null=True, blank=True)
145146
passthrough = models.TextField()
146147
quantity = models.IntegerField()
147148
source = models.URLField()
@@ -187,7 +188,7 @@ def sync_from_paddle_data(cls, data):
187188
event_time=timezone.now(), # ???
188189
marketing_consent=data.get('marketing_consent'),
189190
# next_bill_date can be null if user won't pay again...
190-
next_bill_date=data.get("next_payment", {}).get("date", timezone.now()),
191+
next_bill_date=data.get("next_payment", {}).get("date", None),
191192
passthrough="", # ???
192193
quantity=data.get("last_payment", {}).get("amount", 0),
193194
source="", # ???

0 commit comments

Comments
 (0)