Skip to content
Snippets Groups Projects
Commit 56ed2f9b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

voucher will expiry after 90 days

parent 4f128a8a
No related branches found
No related tags found
1 merge request!136voucher validity
Pipeline #
...@@ -66,7 +66,7 @@ class VoucherForm(ModelForm): ...@@ -66,7 +66,7 @@ class VoucherForm(ModelForm):
instance = super(VoucherForm, self).save(commit=False) instance = super(VoucherForm, self).save(commit=False)
if not instance.id: if not instance.id:
instance.issue_date = timezone.now() instance.issue_date = timezone.now()
instance.expiry_date = instance.issue_date + datetime.timedelta(days=92) instance.expiry_date = instance.issue_date + datetime.timedelta(days=90)
max_id = str(1).zfill(5) max_id = str(1).zfill(5)
if Voucher.objects.all().count() > 0: if Voucher.objects.all().count() > 0:
max_id = str(Voucher.objects.latest('id').id + 1).zfill(5) max_id = str(Voucher.objects.latest('id').id + 1).zfill(5)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment