8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +00:00

Comentaires de maxime sur le champ promo

This commit is contained in:
root 2016-07-04 17:54:52 +02:00
parent 3bdd17a090
commit c9c55f4579
5 changed files with 58 additions and 4 deletions

View file

@ -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),
),
]

View file

@ -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),
),
]

View file

@ -30,7 +30,7 @@ class User(models.Model):
pseudo = models.CharField(max_length=255, unique=True) pseudo = models.CharField(max_length=255, unique=True)
email = models.EmailField() email = models.EmailField()
school = models.ForeignKey('School', on_delete=models.PROTECT) 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) room = models.OneToOneField('topologie.Room', on_delete=models.PROTECT, blank=True, null=True)
pwd_ssha = models.CharField(max_length=255) pwd_ssha = models.CharField(max_length=255)
pwd_ntlm = 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['name'].label = 'Nom'
self.fields['surname'].label = 'Prenom' self.fields['surname'].label = 'Prenom'
self.fields['school'].label = 'Etablissement' self.fields['school'].label = 'Etablissement'
self.fields['comment'].label = 'Commentaire'
self.fields['room'].label = 'Chambre'
class Meta: class Meta:
model = User model = User
@ -90,6 +92,8 @@ class InfoForm(ModelForm):
self.fields['name'].label = 'Nom' self.fields['name'].label = 'Nom'
self.fields['surname'].label = 'Prenom' self.fields['surname'].label = 'Prenom'
self.fields['school'].label = 'Etablissement' self.fields['school'].label = 'Etablissement'
self.fields['comment'].label = 'Commentaire'
self.fields['room'].label = 'Chambre'
def clean_force(self): def clean_force(self):
if self.cleaned_data.get('force', False): if self.cleaned_data.get('force', False):
@ -98,7 +102,7 @@ class InfoForm(ModelForm):
class Meta: class Meta:
model = User model = User
fields = ['name','surname','pseudo','email', 'school', 'promo', 'room'] fields = ['name','surname','pseudo','email', 'school', 'comment', 'room']
class PasswordForm(ModelForm): class PasswordForm(ModelForm):
class Meta: class Meta:

View file

@ -26,8 +26,8 @@
<tr> <tr>
<th>Ecole</th> <th>Ecole</th>
<td>{{ user.school }}</td> <td>{{ user.school }}</td>
<th>Promo</th> <th>Commentaire</th>
<td>{{ user.promo }}</td> <td>{{ user.comment }}</td>
</tr> </tr>
<tr> <tr>
<th>Chambre</th> <th>Chambre</th>

View file

@ -11,4 +11,7 @@
{% bootstrap_form userform %} {% bootstrap_form userform %}
{% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %} {% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
</form> </form>
<br />
<br />
<br />
{% endblock %} {% endblock %}