mirror of
https://github.com/kjanat/livegraphs-django.git
synced 2026-01-16 14:42:09 +01:00
35 lines
826 B
Python
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"
|