add from v002

This commit is contained in:
2026-05-20 21:24:00 +02:00
parent 1a6ba86d0b
commit 83fb8c69bb
98 changed files with 10878 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
from django.contrib.auth.models import AbstractUser
from django.db import models
class CustomUser(AbstractUser):
# Email koristimo za login, pa mora biti jedinstven
email = models.EmailField(unique=True)
# Dodatna polja za tvoju tvrtku
telefon = models.CharField(max_length=20, blank=True)
oib = models.CharField(max_length=11, blank=True, null=True)
is_serviser = models.BooleanField(default=False) # Razlikovanje uloga
# Govorimo Djangu da koristi email umjesto username-a
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['username', 'first_name', 'last_name']
def __str__(self):
return f"{self.first_name} {self.last_name} ({self.email})"