new model fields & migrations for apps.epic & apps.lyric; new FTs, ITs & UTs passing
; some styling changes effected primarily to _gatekeetper.html modal
This commit is contained in:
@@ -71,10 +71,12 @@ class Token(models.Model):
|
||||
COIN = "coin"
|
||||
FREE = "Free"
|
||||
TITHE = "tithe"
|
||||
PASS = "pass"
|
||||
TOKEN_TYPE_CHOICES = [
|
||||
(COIN, "Coin-on-a-String"),
|
||||
(FREE, "Free Token"),
|
||||
(TITHE, "Tithe Token"),
|
||||
(PASS, "Backstage Pass"),
|
||||
]
|
||||
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="tokens")
|
||||
@@ -97,8 +99,8 @@ class Token(models.Model):
|
||||
return ""
|
||||
|
||||
def tooltip_expiry(self):
|
||||
if self.token_type == self.COIN:
|
||||
if self.next_ready_at:
|
||||
if self.token_type in (self.COIN, self.PASS):
|
||||
if self.token_type == self.COIN and self.next_ready_at:
|
||||
return f"Ready {self.next_ready_at.strftime('%Y-%m-%d')}"
|
||||
return "no expiry"
|
||||
if self.expires_at:
|
||||
@@ -143,3 +145,5 @@ def create_wallet_and_tokens(sender, instance, created, **kwargs):
|
||||
token_type=Token.FREE,
|
||||
expires_at=timezone.now() + timedelta(days=7),
|
||||
)
|
||||
if instance.is_staff:
|
||||
Token.objects.create(user=instance, token_type=Token.PASS)
|
||||
|
||||
Reference in New Issue
Block a user