mirror of
https://github.com/kjanat/livegraphs-django.git
synced 2026-01-16 11:42:10 +01:00
Initial commit
This commit is contained in:
34
dashboard_project/accounts/models.py
Normal file
34
dashboard_project/accounts/models.py
Normal file
@ -0,0 +1,34 @@
|
||||
# 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"
|
||||
Reference in New Issue
Block a user