X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ca336bd1f9658cf713681d1412d4153e5c4d9c93..7e113c61d336d677b96ff0ed55a5f81eb2b80d53:/src/club/models.py?ds=inline diff --git a/src/club/models.py b/src/club/models.py index f5cbf6e7f..d7be28732 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -22,7 +22,8 @@ class Plan(models.Model): ] interval = models.SmallIntegerField(_('inteval'), choices=intervals) - min_amount = models.DecimalField(_('min_amount'), max_digits=10, decimal_places=2) + min_amount = models.DecimalField(_('min amount'), max_digits=10, decimal_places=2) + default_amount = models.DecimalField(_('default amount'), max_digits=10, decimal_places=2) allow_recurring = models.BooleanField(_('allow recurring')) allow_one_time = models.BooleanField(_('allow one time')) active = models.BooleanField(_('active'), default=True) @@ -102,6 +103,7 @@ class Membership(models.Model): """ Represents a user being recognized as a member of the club. """ user = models.OneToOneField(settings.AUTH_USER_MODEL, verbose_name=_('user'), on_delete=models.CASCADE) created_at = models.DateTimeField(_('created at'), auto_now_add=True) + name = models.CharField(max_length=255, blank=True) honorary = models.BooleanField(default=False) class Meta: @@ -183,7 +185,8 @@ class PayUOrder(payu_models.Order): def status_updated(self): if self.status == 'COMPLETED': - new_exp = self.schedule.plan.get_next_installment(now()) + since = self.schedule.expires_at or now() + new_exp = self.schedule.plan.get_next_installment(since) if self.schedule.expires_at is None or self.schedule.expires_at < new_exp: self.schedule.expires_at = new_exp self.schedule.save()