Files
livegraphs-django/dashboard_project/accounts/models.py
2025-05-17 00:57:08 +02:00

35 lines
826 B
Python

# accounts/models.py
from django.contrib.auth.models import AbstractUser
from django.db import models
class CustomUser(AbstractUser):
"""Custom user model to extend the default Django user"""
company = models.ForeignKey(
"Company",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="employees",
)
is_company_admin = models.BooleanField(default=False)
def __str__(self):
return self.username
class Company(models.Model):
"""Model for companies that will access the dashboard"""
name = models.CharField(max_length=100)
description = models.TextField(blank=True)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.name
class Meta:
verbose_name_plural = "Companies"