From 781d550263bfd15ae182c361729718f1ff676031 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Jul 2016 17:54:52 +0200 Subject: [PATCH] Comentaires de maxime sur le champ promo --- users/migrations/0013_auto_20160704_1547.py | 24 +++++++++++++++++++++ users/migrations/0014_auto_20160704_1548.py | 23 ++++++++++++++++++++ users/models.py | 8 +++++-- users/templates/users/profil.html | 4 ++-- users/templates/users/user.html | 3 +++ 5 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 users/migrations/0013_auto_20160704_1547.py create mode 100644 users/migrations/0014_auto_20160704_1548.py diff --git a/users/migrations/0013_auto_20160704_1547.py b/users/migrations/0013_auto_20160704_1547.py new file mode 100644 index 00000000..cbccfcf6 --- /dev/null +++ b/users/migrations/0013_auto_20160704_1547.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0012_auto_20160703_1230'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='comment', + field=models.CharField(max_length=255, help_text="Infos sur l'etablissement (optionnel)", blank=True), + ), + migrations.AlterField( + model_name='user', + name='promo', + field=models.CharField(max_length=255, blank=True), + ), + ] diff --git a/users/migrations/0014_auto_20160704_1548.py b/users/migrations/0014_auto_20160704_1548.py new file mode 100644 index 00000000..f0905b8a --- /dev/null +++ b/users/migrations/0014_auto_20160704_1548.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0013_auto_20160704_1547'), + ] + + operations = [ + migrations.RemoveField( + model_name='user', + name='promo', + ), + migrations.AlterField( + model_name='user', + name='comment', + field=models.CharField(blank=True, help_text='Commentaire, promo', max_length=255), + ), + ] diff --git a/users/models.py b/users/models.py index c30e4a68..e65c3966 100644 --- a/users/models.py +++ b/users/models.py @@ -30,7 +30,7 @@ class User(models.Model): pseudo = models.CharField(max_length=255, unique=True) email = models.EmailField() school = models.ForeignKey('School', on_delete=models.PROTECT) - promo = models.CharField(max_length=255) + comment = models.CharField(help_text="Commentaire, promo", max_length=255, blank=True) room = models.OneToOneField('topologie.Room', on_delete=models.PROTECT, blank=True, null=True) pwd_ssha = models.CharField(max_length=255) pwd_ntlm = models.CharField(max_length=255) @@ -77,6 +77,8 @@ class UserForm(ModelForm): self.fields['name'].label = 'Nom' self.fields['surname'].label = 'Prenom' self.fields['school'].label = 'Etablissement' + self.fields['comment'].label = 'Commentaire' + self.fields['room'].label = 'Chambre' class Meta: model = User @@ -90,6 +92,8 @@ class InfoForm(ModelForm): self.fields['name'].label = 'Nom' self.fields['surname'].label = 'Prenom' self.fields['school'].label = 'Etablissement' + self.fields['comment'].label = 'Commentaire' + self.fields['room'].label = 'Chambre' def clean_force(self): if self.cleaned_data.get('force', False): @@ -98,7 +102,7 @@ class InfoForm(ModelForm): class Meta: model = User - fields = ['name','surname','pseudo','email', 'school', 'promo', 'room'] + fields = ['name','surname','pseudo','email', 'school', 'comment', 'room'] class PasswordForm(ModelForm): class Meta: diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html index 1a41332c..4b94c851 100644 --- a/users/templates/users/profil.html +++ b/users/templates/users/profil.html @@ -26,8 +26,8 @@ Ecole {{ user.school }} - Promo - {{ user.promo }} + Commentaire + {{ user.comment }} Chambre diff --git a/users/templates/users/user.html b/users/templates/users/user.html index c9945eaa..64c3bbec 100644 --- a/users/templates/users/user.html +++ b/users/templates/users/user.html @@ -11,4 +11,7 @@ {% bootstrap_form userform %} {% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %} +
+
+
{% endblock %}