Browse Source

nom d’usage

Élie Bouttier 7 years ago
parent
commit
48b4080170

+ 1 - 1
accounts/forms.py

@@ -14,7 +14,7 @@ class UserForm(ModelForm):
 class ProfileForm(ModelForm):
     class Meta:
         model = Profile
-        fields = ('phone_number', 'address', 'ssh_keys',)
+        fields = ('common_name', 'phone_number', 'address', 'ssh_keys',)
 
 
 class PasswordResetForm(AuthPasswordResetForm):

+ 18 - 0
accounts/migrations/0007_profile_common_name.py

@@ -0,0 +1,18 @@
+# Generated by Django 2.0.2 on 2018-02-15 23:16
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('accounts', '0006_auto_20170607_2306'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='profile',
+            name='common_name',
+            field=models.CharField(blank=True, default='', max_length=32, verbose_name='Nom d’usage'),
+        ),
+    ]

+ 2 - 1
accounts/models.py

@@ -7,6 +7,7 @@ from adhesions.models import Adhesion, User, Corporation
 
 class Profile(models.Model):
     user = models.OneToOneField(User, related_name='profile', verbose_name='Utilisateur', on_delete=models.CASCADE)
+    common_name = models.CharField(max_length=32, blank=True, default='', verbose_name='Nom d’usage')
     phone_number = models.CharField(max_length=16, blank=True, default='',
                                     verbose_name='Numéro de téléphone')
     address = models.TextField(blank=True, default='', verbose_name='Adresse')
@@ -25,4 +26,4 @@ class Profile(models.Model):
         return Adhesion.objects.filter(models.Q(user__pk=self.user.pk) | models.Q(corporation__members__profile__pk=self.pk))
 
     def __str__(self):
-        return self.user.get_full_name() or self.user.username
+        return self.common_name or self.user.get_full_name() or self.user.username

+ 18 - 0
adhesions/migrations/0019_auto_20180216_0016.py

@@ -0,0 +1,18 @@
+# Generated by Django 2.0.2 on 2018-02-15 23:16
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('adhesions', '0018_auto_20180210_1612'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='adhesion',
+            name='id',
+            field=models.AutoField(primary_key=True, serialize=False, verbose_name='Numéro d’adhérent·e'),
+        ),
+    ]

+ 19 - 0
services/migrations/0050_auto_20180216_0016.py

@@ -0,0 +1,19 @@
+# Generated by Django 2.0.2 on 2018-02-15 23:16
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('services', '0049_auto_20180212_2051'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='service',
+            name='adhesion',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='services', to='adhesions.Adhesion', verbose_name='Adhérent·e'),
+        ),
+    ]