aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/users/models.py
blob: b53c2174de552aa810d31eec6e402be8d544db32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _

from ctrack.organisations.models import Stakeholder


class User(AbstractUser):

    name = models.CharField(_("Name of User"), blank=True, max_length=255)
    stakeholder = models.OneToOneField(
        Stakeholder, on_delete=models.CASCADE, null=True, blank=True
    )

    def get_absolute_url(self):
        return reverse("users:detail", kwargs={"username": self.username})