Migrate to is_supervisor being a database field

More efficient, but it does reduce app seperation. Probably not an issue for us!
This commit is contained in:
2022-01-09 15:06:11 +00:00
parent b539312538
commit 6414e68231
9 changed files with 58 additions and 21 deletions

View File

@@ -27,6 +27,7 @@ class Profile(AbstractUser):
# Currently only populated by the admin approval email. TODO: Populate it each time we send any email, might need that...
last_emailed = models.DateTimeField(blank=True, null=True)
dark_theme = models.BooleanField(default=False)
is_supervisor = models.BooleanField(default=False)
reversion_hide = True
@@ -56,11 +57,6 @@ class Profile(AbstractUser):
def latest_events(self):
return self.event_mic.order_by('-start_date').select_related('person', 'organisation', 'venue', 'mic', 'riskassessment', 'invoice').prefetch_related('checklists')
@cached_property
def as_trainee(self):
from training.models import Trainee
return Trainee.objects.get(pk=self.pk)
@classmethod
def admins(cls):
return Profile.objects.filter(email__in=[y for x in settings.ADMINS for y in x])