1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Fix adh migration

This commit is contained in:
Alexandre Iooss 2019-07-16 09:17:57 +02:00
parent 9d56b6ecbf
commit e66d46127b
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 13 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 2.2.3 on 2019-07-08 11:48 # Generated by Django 2.2.3 on 2019-07-16 07:17
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
@ -18,8 +18,14 @@ class Migration(migrations.Migration):
name='Profile', name='Profile',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('phone_number', models.CharField(max_length=255, verbose_name='phone number')), ('avatar', models.ImageField(blank=True, max_length=255, upload_to='', verbose_name='profile picture')),
('phone_number', models.CharField(blank=True, default='', max_length=50, null=True, verbose_name='phone number')),
('section', models.CharField(help_text='e.g. "1A0", "9A♥", "SAPHIRE"', max_length=255, verbose_name='section')), ('section', models.CharField(help_text='e.g. "1A0", "9A♥", "SAPHIRE"', max_length=255, verbose_name='section')),
('genre', models.CharField(blank=True, choices=[(None, 'ND'), ('M', 'M'), ('F', 'F')], max_length=1, null=True)),
('address', models.TextField(blank=True, null=True)),
('paid', models.BooleanField(default=False, verbose_name='paid')),
('is_active', models.BooleanField(default=True, verbose_name='is active')),
('is_deleted', models.BooleanField(default=False, verbose_name='is deleted')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
], ],
options={ options={

View File

@ -35,7 +35,7 @@ class Profile(models.Model):
phone_number = models.CharField( phone_number = models.CharField(
max_length=50, max_length=50,
blank=True, blank=True,
null=False, null=True,
default='', default='',
verbose_name=_('phone number'), verbose_name=_('phone number'),
) )
@ -46,15 +46,13 @@ class Profile(models.Model):
) )
genre = models.CharField( genre = models.CharField(
max_length=1, max_length=1,
blank=False, blank=True,
null=False, null=True,
choices=GENRES, choices=GENRES,
default=None,
) )
address = models.TextField( address = models.TextField(
blank=True, blank=True,
null=False, null=True,
default='',
) )
paid = models.BooleanField( paid = models.BooleanField(
verbose_name=_("paid"), verbose_name=_("paid"),
@ -73,9 +71,6 @@ class Profile(models.Model):
verbose_name = _('user profile') verbose_name = _('user profile')
verbose_name_plural = _('user profile') verbose_name_plural = _('user profile')
def __str__(self):
return self.user.get_username()
class MembershipFee(models.Model): class MembershipFee(models.Model):
""" """
@ -99,12 +94,9 @@ class MembershipFee(models.Model):
verbose_name = _('membership fee') verbose_name = _('membership fee')
verbose_name_plural = _('membership fees') verbose_name_plural = _('membership fees')
def __str__(self):
return self.user.get_username()
@receiver(post_save, sender=User) @receiver(post_save, sender=User)
def save_user_profile(sender, instance, created, **_kwargs): def save_user_profile(instance, created, **_kwargs):
""" """
Hook to save an user profile when an user is updated Hook to save an user profile when an user is updated
""" """