fixing profile view
This commit is contained in:
parent
f0c3def935
commit
b16219f8ee
4 changed files with 10 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -8,11 +8,16 @@
|
|||
{% if success %}
|
||||
<p class="success">Votre profil a été mis à jour avec succès !</p>
|
||||
{% endif %}
|
||||
<form id="profile form-horizontal" method="post" action="{% url 'cof.views.profile' %}">
|
||||
<form id="profile form-horizontal" method="post" action="{% url 'gestion:profile' %}">
|
||||
<div class="row" style="margin: 0 15%;">
|
||||
{% csrf_token %}
|
||||
<fieldset"center-block">
|
||||
{% for field in form %}
|
||||
{% for field in user_form %}
|
||||
{{ field | bootstrap }}
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
<fieldset"center-block">
|
||||
{% for field in profile_form %}
|
||||
{{ field | bootstrap }}
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
|
|
|
@ -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"),
|
||||
]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue