roo roo roo down the river we go...
This commit is contained in:
43
users/models.py
Normal file
43
users/models.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.db import models
|
||||
from tenants.models import Tenant
|
||||
|
||||
|
||||
class User(AbstractUser):
|
||||
"""
|
||||
Custom User model that extends Django's AbstractUser.
|
||||
Supports multi-tenancy by linking users to specific tenants.
|
||||
"""
|
||||
tenant = models.ForeignKey(
|
||||
Tenant,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='users',
|
||||
null=True,
|
||||
blank=True
|
||||
)
|
||||
is_job_seeker = models.BooleanField(default=False)
|
||||
is_employer = models.BooleanField(default=False)
|
||||
is_tenant_admin = models.BooleanField(default=False)
|
||||
is_global_admin = models.BooleanField(default=False)
|
||||
|
||||
# Additional fields for job seekers
|
||||
resume = models.FileField(upload_to='resumes/', null=True, blank=True)
|
||||
bio = models.TextField(max_length=1000, blank=True)
|
||||
phone_number = models.CharField(max_length=15, blank=True)
|
||||
|
||||
# Additional fields for employers
|
||||
company_name = models.CharField(max_length=200, blank=True)
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.username} ({self.email})"
|
||||
|
||||
def get_full_name(self):
|
||||
"""
|
||||
Return the user's full name.
|
||||
"""
|
||||
if self.first_name and self.last_name:
|
||||
return f"{self.first_name} {self.last_name}"
|
||||
return self.username
|
||||
Reference in New Issue
Block a user