Making expireable a abstract model
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
from django.utils import timezone
|
||||
from django.db import models
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
|
||||
@@ -55,7 +56,14 @@ class Submittable(models.Model):
|
||||
|
||||
class Expireable(models.Model):
|
||||
"""
|
||||
Base class for things that can expire, i.e. VouchersAv
|
||||
Base class for things that can expire, i.e. Vouchers
|
||||
"""
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
created_when = models.DateTimeField(auto_now_add=True)
|
||||
expires_when = models.DateTimeField()
|
||||
expires_when = models.DateTimeField()
|
||||
|
||||
@property
|
||||
def is_expired(self):
|
||||
return timezone.now() > self.expires_when
|
Reference in New Issue
Block a user