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
|
# Page d'accueil
|
||||||
url(r'^$', cof_views.home, name='home'),
|
url(r'^$', cof_views.home, name='home'),
|
||||||
# The common views
|
# The common views
|
||||||
url(r"^$", include("gestion.urls")),
|
url(r"^", include("gestion.urls", namespace='gestion')),
|
||||||
# Le BdA
|
# Le BdA
|
||||||
url(r'^bda/', include('bda.urls')),
|
url(r'^bda/', include('bda.urls')),
|
||||||
# Les exports
|
# Les exports
|
||||||
|
|
|
@ -8,11 +8,16 @@
|
||||||
{% if success %}
|
{% if success %}
|
||||||
<p class="success">Votre profil a été mis à jour avec succès !</p>
|
<p class="success">Votre profil a été mis à jour avec succès !</p>
|
||||||
{% endif %}
|
{% 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%;">
|
<div class="row" style="margin: 0 15%;">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<fieldset"center-block">
|
<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 }}
|
{{ field | bootstrap }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -3,8 +3,6 @@ from django.conf.urls import url
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
|
|
||||||
app_name = "gestion"
|
|
||||||
|
|
||||||
urlpatterns = [
|
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":
|
if request.method == "POST":
|
||||||
user_form = UserForm(request.POST, instance=user)
|
user_form = UserForm(request.POST, instance=user)
|
||||||
profile_form = ProfileForm(request.POST, instance=user.profile)
|
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()
|
user_form.save()
|
||||||
profile_form.save()
|
profile_form.save()
|
||||||
success = True
|
success = True
|
||||||
|
|
Loading…
Add table
Reference in a new issue