summaryrefslogtreecommitdiffstats
path: root/myuser/models.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-10-15 14:28:30 +0100
committerMatthew Lemon <y@yulqen.org>2024-10-15 14:28:30 +0100
commita47f71efc9a7643be548f7f805e162a1942d3db4 (patch)
tree97dfb055c67ec582765658c9ccfa3ca3012caf06 /myuser/models.py
parent9015934a186b8843cc6d5ec48e41c5e2408f3fcf (diff)
More CSS improvements and wip on profile page
- uses dividers between divs which I'm not sure I like - etc
Diffstat (limited to 'myuser/models.py')
-rw-r--r--myuser/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/myuser/models.py b/myuser/models.py
index d9f8aba..d0f70ec 100644
--- a/myuser/models.py
+++ b/myuser/models.py
@@ -3,6 +3,8 @@ from django.contrib.auth.models import PermissionsMixin
from django.db import models
from django.db.models import BooleanField, CharField, EmailField
+from engagements.models import Engagement
+
class Common(models.Model):
date_created = models.DateTimeField(auto_now_add=True)
@@ -60,6 +62,7 @@ class TeamUser(AbstractBaseUser, PermissionsMixin):
The `has_perm` and `has_module_perms` methods are placeholders that always return `True`, indicating that the user has all permissions. The `is_staff` property is also a placeholder that returns the value of `is_admin`.
"""
+
email = EmailField(verbose_name="email address", max_length=255, unique=True)
first_name = CharField(max_length=20, null=True, blank=True)
last_name = CharField(max_length=20, null=True, blank=True)
@@ -78,6 +81,9 @@ class TeamUser(AbstractBaseUser, PermissionsMixin):
def __str__(self):
return self.email
+ def get_all_engagements(self):
+ return Engagement.objects.filter(officers__id__contains=self.id)
+
def fullname(self):
return f"{self.first_name} {self.last_name}"