summaryrefslogtreecommitdiffstats
path: root/myuser
diff options
context:
space:
mode:
Diffstat (limited to 'myuser')
-rw-r--r--myuser/models.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/myuser/models.py b/myuser/models.py
index 1236ba6..d9f8aba 100644
--- a/myuser/models.py
+++ b/myuser/models.py
@@ -41,6 +41,25 @@ class Team(Common):
class TeamUser(AbstractBaseUser, PermissionsMixin):
+ """
+ The `TeamUser` class is a custom user model that extends the `AbstractBaseUser` and `PermissionsMixin` classes from Django's built-in authentication system. It provides a user model with the following fields:
+
+ - `email`: The user's email address, which is used as the unique identifier for the user.
+ - `first_name`: The user's first name (optional).
+ - `last_name`: The user's last name (optional).
+ - `dapsy`: A boolean field indicating whether the user is a DAPSY user.
+ - `is_active`: A boolean field indicating whether the user is active.
+ - `is_admin`: A boolean field indicating whether the user is an admin.
+ - `team`: A foreign key relationship to the `Team` model, indicating the team the user belongs to.
+ - `lead_for`: A many-to-many relationship to the `engagements.Organisation` model, indicating the organizations the user is a lead inspector for.
+ - `designation`: The user's designation (optional).
+
+ The `TeamUser` class also overrides the default user manager with the `TeamMgr` class, which provides custom methods for creating regular and superuser accounts.
+
+ The `__str__` method returns the user's email address, and the `fullname` method returns the user's full name (first and last name).
+
+ 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)