X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/09afe5bd72a407c6d6474ccce467b7a9dddda0bf..0c9e7e914bc548bee30add46fb6e4aadf6ffb16c:/apps/funding/models.py diff --git a/apps/funding/models.py b/apps/funding/models.py index 3a74238e7..de52ac9d8 100644 --- a/apps/funding/models.py +++ b/apps/funding/models.py @@ -124,6 +124,9 @@ class Offer(models.Model): """ QuerySet for all completed payments for the offer. """ return Funding.payed().filter(offer=self) + def funders(self): + return self.funding_payed().order_by('-amount', 'payed_at') + def sum(self): """ The money gathered. """ return self.funding_payed().aggregate(s=models.Sum('amount'))['s'] or 0 @@ -230,6 +233,9 @@ class Funding(models.Model): def get_absolute_url(self): return reverse('funding_funding', args=[self.pk]) + def perk_names(self): + return ", ".join(perk.name for perk in self.perks.all()) + def get_disable_notifications_url(self): return "%s?%s" % (reverse("funding_disable_notifications"), urlencode({