From b16219f8ee9c3ac2431387a07d9faa18d92cb601 Mon Sep 17 00:00:00 2001 From: Qwann Date: Sat, 11 Feb 2017 17:57:37 +0100 Subject: [PATCH] fixing profile view --- gestioCOF/urls.py | 2 +- gestion/templates/gestion/profile.html | 9 +++++++-- gestion/urls.py | 4 +--- gestion/views.py | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gestioCOF/urls.py b/gestioCOF/urls.py index c76337a2..d4a01618 100644 --- a/gestioCOF/urls.py +++ b/gestioCOF/urls.py @@ -31,7 +31,7 @@ urlpatterns = [ # Page d'accueil url(r'^$', cof_views.home, name='home'), # The common views - url(r"^$", include("gestion.urls")), + url(r"^", include("gestion.urls", namespace='gestion')), # Le BdA url(r'^bda/', include('bda.urls')), # Les exports diff --git a/gestion/templates/gestion/profile.html b/gestion/templates/gestion/profile.html index 54bdb9b6..183b36e4 100644 --- a/gestion/templates/gestion/profile.html +++ b/gestion/templates/gestion/profile.html @@ -8,11 +8,16 @@ {% if success %}

Votre profil a été mis à jour avec succès !

{% endif %} -
+
{% csrf_token %} - {% for field in form %} + {% for field in user_form %} + {{ field | bootstrap }} + {% endfor %} + + + {% for field in profile_form %} {{ field | bootstrap }} {% endfor %} diff --git a/gestion/urls.py b/gestion/urls.py index a5075985..037101dc 100644 --- a/gestion/urls.py +++ b/gestion/urls.py @@ -3,8 +3,6 @@ from django.conf.urls import url from . import views -app_name = "gestion" - urlpatterns = [ - url(r"^profile$", views.profile, name="profile"), + url(r"^profile/?$", views.profile, name="profile"), ] diff --git a/gestion/views.py b/gestion/views.py index 698d7886..a4e1d71c 100644 --- a/gestion/views.py +++ b/gestion/views.py @@ -11,7 +11,7 @@ def profile(request): if request.method == "POST": user_form = UserForm(request.POST, instance=user) profile_form = ProfileForm(request.POST, instance=user.profile) - if all(user_form.is_valid(), profile_form.is_valid()): + if all((user_form.is_valid(), profile_form.is_valid())): user_form.save() profile_form.save() success = True