academon/core/models/crew.py

27 lines
705 B
Python
Raw Normal View History

2022-09-20 14:02:39 +00:00
from django.db import models
2022-09-26 14:27:52 +00:00
from django.utils import timezone
2022-09-20 14:02:39 +00:00
2022-09-26 14:27:52 +00:00
from ..helpers.uploads import get_upload_path
2022-09-20 14:02:39 +00:00
class CrewMember(models.Model):
pin = models.IntegerField(primary_key=True)
first_name = models.CharField(max_length=256)
last_name = models.CharField(max_length=256)
email = models.EmailField()
dob = models.DateField()
2022-09-26 14:27:52 +00:00
profile_picture = models.ImageField(upload_to=get_upload_path)
2022-09-20 14:02:39 +00:00
2022-09-26 14:27:52 +00:00
expiry = models.DateTimeField(null=True, blank=True)
@classmethod
def get_or_import(cls, pin):
try:
found = cls.objects.get(pin=pin)
if found.expiry and found.expiry < timezone.now():
2022-09-26 14:30:45 +00:00
pass
except:
pass