Commit 29795b9c authored by Gabriel Detraz's avatar Gabriel Detraz

On verifie que postaladress est un nombre, et on rattrappe l'erreur ldap de champ identiques

parent b51e6027
......@@ -12,6 +12,7 @@ from django.core.exceptions import PermissionDenied
from settings import BASE_LDAP_TEST
from django.contrib import messages
from models import ConfirmAction
from forms import DemenagementForm
import lc_ldap.shortcuts
......@@ -87,6 +88,9 @@ 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_ville = f.cleaned_data['adresse_ville']
if keep_connection and status != 'is_crous_cachan':
......@@ -102,7 +106,14 @@ def demenagement(request, pk, secret, ldap):
for machine in adh.machines():
adh['postalAddress'] = adresse_complete
adh['postalAddress'] = adresse_complete
except ValueError:
messages.error(request, u"""Cette adresse est invalide""" )
return render(request, 'validation/demenagement.html', {
'chbre' : chbre,
'form' : f,
# On modifie la chambre de l'adhérent
adh['chbre'] = new_chbre
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