Files
@ 1064a12981d7
Branch filter:
Location: website/conservancy/supporters/models.py - annotation
1064a12981d7
2.9 KiB
text/x-python
Bring Stripe sustainer form into "Become a sustainer" page
26a6928a2046 462cbc396354 462cbc396354 47a30a750ad1 462cbc396354 462cbc396354 462cbc396354 462cbc396354 462cbc396354 462cbc396354 462cbc396354 462cbc396354 462cbc396354 adf2229720fc 462cbc396354 462cbc396354 9e39d7eadced 5688ffcd4898 26a6928a2046 26a6928a2046 26a6928a2046 3fe83d14667f 3fe83d14667f 3fe83d14667f 3fe83d14667f 3fe83d14667f 26a6928a2046 26a6928a2046 26a6928a2046 a74244efb44e 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 3fe83d14667f a74244efb44e a74244efb44e 26a6928a2046 3fe83d14667f 3fe83d14667f a74244efb44e 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 | from django.core import validators
from django.db import models
class Supporter(models.Model):
"""Conservancy Supporter listing"""
display_name = models.CharField(max_length=200, blank=False)
display_until_date = models.DateTimeField("date until which this supporter name is displayed")
ledger_entity_id = models.CharField(max_length=200, blank=False)
def test(self):
return "TESTING"
def __str__(self):
return self.display_name
class Meta:
ordering = ('ledger_entity_id',)
class SustainerOrder(models.Model):
RENEW_CHOICES = [
('', 'None'),
('month', 'Monthly'),
('year', 'Annual'),
]
TSHIRT_CHOICES = [
(
'',
(("", "None"),),
),
(
"Men's",
(
("Men's S", "Men's S"),
("Men's M", "Men's M"),
("Men's L", "Men's L"),
("Men's XL", "Men's XL"),
("Men's 2XL", "Men's 2XL"),
),
),
(
"Standard women's",
(
("Standard women's S", "Standard women's S"),
("Standard women's M", "Standard women's M"),
("Standard women's L", "Standard women's L"),
("Standard women's XL", "Standard women's XL"),
("Standard women's 2XL", "Standard women's 2XL"),
),
),
(
"Fitted women's",
(
("Fitted women's S", "Fitted women's S"),
("Fitted women's M", "Fitted women's M"),
("Fitted women's L", "Fitted women's L"),
("Fitted women's XL", "Fitted women's XL"),
("Fitted women's 2XL", "Fitted women's 2XL"),
),
),
]
created_time = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=255)
email = models.EmailField()
amount = models.IntegerField(
validators=[
validators.MinValueValidator(100),
])
recurring = models.CharField(max_length=10)
payment_method = models.CharField(max_length=10, default='Stripe')
payment_id = models.CharField(max_length=255, blank=True)
paid_time = models.DateTimeField(null=True, blank=True)
acknowledge_publicly = models.BooleanField(default=True)
add_to_mailing_list = models.BooleanField(default=True)
tshirt_size = models.CharField(max_length=50, choices=TSHIRT_CHOICES, blank=True)
street = models.CharField(max_length=255, blank=True)
city = models.CharField(max_length=255, blank=True)
state = models.CharField(max_length=255, blank=True)
zip_code = models.CharField(max_length=255, blank=True)
country = models.CharField(max_length=255, blank=True)
def __str__(self):
return f'Sustainer order {self.id}: {self.email}'
def paid(self):
return self.paid_time is not None
|