add profiles fields

This commit is contained in:
Pierre-antoine Comby 2019-07-08 16:00:02 +02:00
parent f8c972d49c
commit 9ef0d5423d
1 changed files with 36 additions and 1 deletions

View File

@ -17,12 +17,28 @@ class Profile(models.Model):
We do not want to patch the Django Contrib Auth User class We do not want to patch the Django Contrib Auth User class
so this model add an user profile with additional information. so this model add an user profile with additional information.
""" """
GENRES = [
(None, "ND"),
("M", "M"),
("F", "F"),
]
user = models.OneToOneField( user = models.OneToOneField(
settings.AUTH_USER_MODEL, settings.AUTH_USER_MODEL,
on_delete=models.CASCADE, on_delete=models.CASCADE,
) )
phone_number = models.CharField( avatar = models.ImageField(
max_length=255, max_length=255,
blank=True,
verbose_name=_('profile picture')
)
phone_number = models.CharField(
max_length=50,
blank=True,
null=False,
default='',
verbose_name=_('phone number'), verbose_name=_('phone number'),
) )
section = models.CharField( section = models.CharField(
@ -30,6 +46,25 @@ class Profile(models.Model):
verbose_name=_('section'), verbose_name=_('section'),
help_text=_('e.g. "1A0", "9A♥", "SAPHIRE"'), help_text=_('e.g. "1A0", "9A♥", "SAPHIRE"'),
) )
genre = models.CharField(max_length=1,
blank=False,
null=False,
choices=GENRES
)
address = models.TextField(
blank=True,
null=False,
default=''
)
remunere = models.BooleanField(verbose_name=_("rémunéré"),
default=False,
)
is_active = models.BooleanField(verbose_name=_("compte actif"),
default=True
)
is_deleted = models.BooleanField(verbose_name=_("compte supprimé"),
default=False
)
class Meta: class Meta:
verbose_name = _('user profile') verbose_name = _('user profile')