fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor edit
[wolnelektury.git]
/
src
/
club
/
models.py
diff --git
a/src/club/models.py
b/src/club/models.py
index
98b4ee0
..
6766694
100644
(file)
--- a/
src/club/models.py
+++ b/
src/club/models.py
@@
-69,6
+69,10
@@
class Club(models.Model):
c[f'{tag}_wide_spot'] = wide_spot
return c
c[f'{tag}_wide_spot'] = wide_spot
return c
+ def get_description_for_amount(self, amount, monthly):
+ amounts = self.monthlyamount_set if monthly else self.singleamount_set
+ amount = amounts.all().filter(amount__lte=amount).last()
+ return amount.description if amount is not None else ''
class SingleAmount(models.Model):
class SingleAmount(models.Model):
@@
-146,6
+150,10
@@
class Schedule(models.Model):
super(Schedule, self).save(*args, **kwargs)
self.update_contact()
super(Schedule, self).save(*args, **kwargs)
self.update_contact()
+ def get_description(self):
+ club = Club.objects.first()
+ return club.get_description_for_amount(self.amount, self.monthly)
+
def initiate_payment(self, request):
return self.get_payment_method().initiate(request, self)
def initiate_payment(self, request):
return self.get_payment_method().initiate(request, self)