From 9ef0d5423d5acdbec980b4bc918aacc261eb5236 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Mon, 8 Jul 2019 16:00:02 +0200 Subject: [PATCH] add profiles fields --- adherents/models.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/adherents/models.py b/adherents/models.py index 41277c57..cb81a287 100644 --- a/adherents/models.py +++ b/adherents/models.py @@ -17,12 +17,28 @@ class Profile(models.Model): We do not want to patch the Django Contrib Auth User class so this model add an user profile with additional information. """ + + GENRES = [ + (None, "ND"), + ("M", "M"), + ("F", "F"), + ] + user = models.OneToOneField( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, ) - phone_number = models.CharField( + avatar = models.ImageField( 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'), ) section = models.CharField( @@ -30,6 +46,25 @@ class Profile(models.Model): verbose_name=_('section'), 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: verbose_name = _('user profile')