Files
backend/api/cuser/models.py
2025-10-05 15:44:08 -06:00

23 lines
1023 B
Python

import uuid
from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class CustomUser(AbstractUser):
"""
Custom user model that extends the default Django user model.
"""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
organizacion = models.ForeignKey('organization.Organizacion', on_delete=models.CASCADE, null=True, blank=True, related_name='users')
profile_picture = models.ImageField(upload_to='profile_pictures/', null=True, blank=True)
is_importador = models.BooleanField(default=False, help_text="Indicates if the user is an importer")
rfc = models.ForeignKey('customs.Importador', on_delete=models.SET_NULL, null=True, blank=True, related_name='users', help_text="RFC associated with the user if they are an importer")
def __str__(self):
return self.username
class Meta:
verbose_name = 'Custom User'
verbose_name_plural = 'Custom Users'
ordering = ['username']