1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-23 07:52:23 +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.db import migrations, models
@ -18,8 +18,14 @@ class Migration(migrations.Migration):
name='Profile',
fields=[
('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')),
('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)),
],
options={

View File

@ -35,7 +35,7 @@ class Profile(models.Model):
phone_number = models.CharField(
max_length=50,
blank=True,
null=False,
null=True,
default='',
verbose_name=_('phone number'),
)
@ -46,15 +46,13 @@ class Profile(models.Model):
)
genre = models.CharField(
max_length=1,
blank=False,
null=False,
blank=True,
null=True,
choices=GENRES,
default=None,
)
address = models.TextField(
blank=True,
null=False,
default='',
null=True,
)
paid = models.BooleanField(
verbose_name=_("paid"),
@ -73,9 +71,6 @@ class Profile(models.Model):
verbose_name = _('user profile')
verbose_name_plural = _('user profile')
def __str__(self):
return self.user.get_username()
class MembershipFee(models.Model):
"""
@ -99,12 +94,9 @@ class MembershipFee(models.Model):
verbose_name = _('membership fee')
verbose_name_plural = _('membership fees')
def __str__(self):
return self.user.get_username()
@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
"""