20 lines
No EOL
789 B
Python
20 lines
No EOL
789 B
Python
from polymorphic.models import PolymorphicModel
|
|
from phonenumber_field.modelfields import PhoneNumberField
|
|
|
|
from django.db.models import OneToOneField, CASCADE, CharField, ImageField
|
|
from django.contrib.auth import get_user_model
|
|
|
|
from core.helpers.files import generate_storage_filename
|
|
|
|
class Profile(PolymorphicModel):
|
|
user = OneToOneField(get_user_model(), CASCADE)
|
|
mobile = PhoneNumberField(blank=True)
|
|
|
|
class AdminProfile(Profile):
|
|
role = CharField(max_length=255)
|
|
image = ImageField(null=True, blank=True, upload_to=generate_storage_filename)
|
|
display_name = CharField("Internal Display Name", max_length=255, null=True, blank=True)
|
|
|
|
@property
|
|
def get_internal_name(self):
|
|
return self.display_name if self.display_name else self.user.get_full_name |