Commit 98e5d75c authored by Hamza Dely's avatar Hamza Dely

[déménagement] Le code postal doit être un nombre entre 01000 et 99999

parent bda9ab86
......@@ -22,7 +22,11 @@ class DemenagementForm(forms.Form):
label=u'Nouvelle chambre (Si tu es sur le campus de Cachan)',
required=False)
adresse_rue = forms.CharField(max_length=510, label=u'Rue', required=False)
adresse_code = forms.CharField(max_length=10, label=u'Code Postal', required=False)
adresse_code = forms.IntegerField(
min_value=1000,
max_value=99999,
label=u'Code postal',
required=False)
adresse_ville = forms.CharField(max_length=255, label=u'Ville', required=False)
def clean(self):
......
......@@ -89,9 +89,7 @@ def demenagement(request, pk, secret, ldap):
new_chbre = f.cleaned_data['new_chbre']
adresse_rue = f.cleaned_data['adresse_rue']
adresse_code = f.cleaned_data['adresse_code']
adresse_code = unicode(adresse_code)
if len(adresse_code)==4:
adresse_code = u'0'+adresse_code
adresse_code = unicode('%05d' % adresse_code)
adresse_ville = f.cleaned_data['adresse_ville']
if keep_connection and status != 'is_crous_cachan':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment