Added command make_donations_charges in order to create stripe current monthly donations from all donators. Now the user can logout using navbar. Added restriction to user in order to make a donation when he has an active monthly donation . Added donations view where the user can view their recents donations. Now users receive an email after making his first donation.
This commit is contained in:
parent
b5557a63a2
commit
4e07385949
14 changed files with 467 additions and 50 deletions
|
|
@ -14,6 +14,9 @@ class DonatorStatus(models.Model):
|
|||
user = models.OneToOneField(CustomUser)
|
||||
status = models.CharField(choices=STATUS_CHOICES, max_length=10, default=ACTIVE)
|
||||
|
||||
def __str__(self):
|
||||
return "%s - %s " % (self.user.email, self.status)
|
||||
|
||||
@classmethod
|
||||
def create(cls, user):
|
||||
cls.objects.get_or_create(user=user)
|
||||
|
|
@ -34,6 +37,10 @@ class Donation(models.Model):
|
|||
obj = cls.objects.create(**data)
|
||||
return obj
|
||||
|
||||
@classmethod
|
||||
def get_total_donations_amount(cls):
|
||||
return sum(cls.objects.all().values_list('donation', flat=True))
|
||||
|
||||
def set_stripe_charge(self, stripe_charge):
|
||||
self.stripe_charge_id = stripe_charge.id
|
||||
self.last4 = stripe_charge.source.last4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue