Browse Source

Comentaires de maxime sur le champ promo

test_david
root 10 years ago
parent
commit
c9c55f4579
  1. 24
      users/migrations/0013_auto_20160704_1547.py
  2. 23
      users/migrations/0014_auto_20160704_1548.py
  3. 8
      users/models.py
  4. 4
      users/templates/users/profil.html
  5. 3
      users/templates/users/user.html

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

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

8
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:

4
users/templates/users/profil.html

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

3
users/templates/users/user.html

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

Loading…
Cancel
Save