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

Redirections plus intelligentes et erreurs non silencieuses

This commit is contained in:
chirac 2016-07-07 00:25:12 +02:00
parent 79cf47e856
commit 46663eeb44
4 changed files with 9 additions and 9 deletions

View file

@ -66,7 +66,7 @@ def new_facture(request, userid):
messages.success(request, "La cotisation a été prolongée pour l'adhérent %s " % user.name ) messages.success(request, "La cotisation a été prolongée pour l'adhérent %s " % user.name )
else: else:
messages.success(request, "La facture a été crée") messages.success(request, "La facture a été crée")
return redirect("/cotisations/") return redirect("/cotisations/profil/" + userid)
return form({'factureform': facture_form}, 'cotisations/facture.html', request) return form({'factureform': facture_form}, 'cotisations/facture.html', request)
def edit_facture(request, factureid): def edit_facture(request, factureid):

View file

@ -66,7 +66,7 @@ def new_machine(request, userid):
messages.error(request, u"Il n'y a plus d'ip disponibles") messages.error(request, u"Il n'y a plus d'ip disponibles")
new_interface.save() new_interface.save()
messages.success(request, "La machine a été crée") messages.success(request, "La machine a été crée")
return redirect("/users/") return redirect("/users/profil/" + userid)
return form({'machineform': machine, 'interfaceform': interface}, 'machines/machine.html', request) return form({'machineform': machine, 'interfaceform': interface}, 'machines/machine.html', request)
def edit_machine(request, interfaceid): def edit_machine(request, interfaceid):

View file

@ -34,7 +34,7 @@ def new_port(request, switch_id):
port.save() port.save()
messages.success(request, "Port ajouté") messages.success(request, "Port ajouté")
except IntegrityError: except IntegrityError:
pass messages.error(request,"Ce port existe déjà" )
return redirect("/topologie/switch/" + switch_id) return redirect("/topologie/switch/" + switch_id)
return form({'topoform':port}, 'topologie/port.html', request) return form({'topoform':port}, 'topologie/port.html', request)

View file

@ -93,7 +93,7 @@ def edit_info(request, userid):
if user.is_valid(): if user.is_valid():
user.save() user.save()
messages.success(request, "L'user a bien été modifié") messages.success(request, "L'user a bien été modifié")
return redirect("/users/") return redirect("/users/profil/" + userid)
return form({'userform': user}, 'users/user.html', request) return form({'userform': user}, 'users/user.html', request)
def state(request, userid): def state(request, userid):
@ -111,7 +111,7 @@ def state(request, userid):
unarchive(user) unarchive(user)
state.save() state.save()
messages.success(request, "Etat changé avec succès") messages.success(request, "Etat changé avec succès")
return redirect("/users/") return redirect("/users/profil/" + userid)
return form({'userform': state}, 'users/user.html', request) return form({'userform': state}, 'users/user.html', request)
def password(request, userid): def password(request, userid):
@ -129,7 +129,7 @@ def password(request, userid):
user.pwd_ntlm = hashNT(user_form.cleaned_data['passwd1']) user.pwd_ntlm = hashNT(user_form.cleaned_data['passwd1'])
user.save() user.save()
messages.success(request, "Le mot de passe a changé") messages.success(request, "Le mot de passe a changé")
return redirect("/users/") return redirect("/users/profil/" + userid)
return form({'userform': user_form}, 'users/user.html', request) return form({'userform': user_form}, 'users/user.html', request)
def add_right(request, userid): def add_right(request, userid):
@ -147,7 +147,7 @@ def add_right(request, userid):
messages.success(request, "Droit ajouté") messages.success(request, "Droit ajouté")
except IntegrityError: except IntegrityError:
pass pass
return redirect("/users/") return redirect("/users/profil/" + userid)
return form({'userform': right}, 'users/user.html', request) return form({'userform': right}, 'users/user.html', request)
def del_right(request): def del_right(request):
@ -170,7 +170,7 @@ def add_ban(request, userid):
if ban.is_valid(): if ban.is_valid():
ban.save() ban.save()
messages.success(request, "Bannissement ajouté") messages.success(request, "Bannissement ajouté")
return redirect("/users/") return redirect("/users/profil/" + userid)
if is_ban(user): if is_ban(user):
messages.error(request, u"Attention, cet utilisateur a deja un bannissement actif" ) messages.error(request, u"Attention, cet utilisateur a deja un bannissement actif" )
return form({'userform': ban}, 'users/user.html', request) return form({'userform': ban}, 'users/user.html', request)
@ -199,7 +199,7 @@ def add_whitelist(request, userid):
if whitelist.is_valid(): if whitelist.is_valid():
whitelist.save() whitelist.save()
messages.success(request, "Accès à titre gracieux accordé") messages.success(request, "Accès à titre gracieux accordé")
return redirect("/users/") return redirect("/users/profil/" + userid)
if is_whitelisted(user): if is_whitelisted(user):
messages.error(request, u"Attention, cet utilisateur a deja un accès gracieux actif" ) messages.error(request, u"Attention, cet utilisateur a deja un accès gracieux actif" )
return form({'userform': whitelist}, 'users/user.html', request) return form({'userform': whitelist}, 'users/user.html', request)