academon/core/models/crew.py
2022-09-26 14:30:45 +00:00

27 lines
No EOL
705 B
Python

from django.db import models
from django.utils import timezone
from ..helpers.uploads import get_upload_path
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()
profile_picture = models.ImageField(upload_to=get_upload_path)
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():
pass
except:
pass