2020-11-30 22:42:24 +01:00
|
|
|
"""
|
|
|
|
@author p.dolata
|
|
|
|
"""
|
|
|
|
|
|
|
|
import uuid
|
|
|
|
from django.db import models
|
|
|
|
from smartpicasso.app.user.models import User
|
|
|
|
|
|
|
|
|
|
|
|
class UserProfile(models.Model):
|
|
|
|
"""
|
|
|
|
Model representing user's profile
|
|
|
|
"""
|
|
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
|
2020-12-09 19:21:30 +01:00
|
|
|
username = models.CharField(max_length=50, unique=True)
|
2020-11-30 22:42:24 +01:00
|
|
|
first_name = models.CharField(max_length=50, unique=False)
|
|
|
|
last_name = models.CharField(max_length=50, unique=False)
|
|
|
|
|
2020-12-09 20:57:11 +01:00
|
|
|
def __str__(self):
|
|
|
|
return str(self.username) + ' - ' + str(self.first_name) + ' ' + str(self.last_name)
|
|
|
|
|
2020-11-30 22:42:24 +01:00
|
|
|
class Meta:
|
|
|
|
"""
|
2020-12-14 20:09:31 +01:00
|
|
|
Meta to set table name in database
|
2020-11-30 22:42:24 +01:00
|
|
|
"""
|
|
|
|
db_table = 'user_profile'
|