Minor changes

- Création d'un template pour nav
- Modification des liens entre les pages account
- Correction de la balise form dans account_update.html
- Ajout d'un nom pour la résolution inversée de account
This commit is contained in:
Aurélien Delobelle 2016-08-03 06:33:27 +02:00
parent b8fe555741
commit 49fdaa6824
6 changed files with 27 additions and 13 deletions

View file

@ -4,6 +4,8 @@
{% block content %} {% block content %}
<a href="{% url 'kfet.account.create' %}">Créer un compte</a>
<ul> <ul>
{% for account in accounts %} {% for account in accounts %}
<li> <li>

View file

@ -15,7 +15,7 @@
{% elif post and not success %} {% elif post and not success %}
<p>Echec de la mise à jour des informations</p> <p>Echec de la mise à jour des informations</p>
{% endif %} {% endif %}
<form submit="{% url 'kfet.account.update' account.trigramme %}" method="post"> <form action="{% url 'kfet.account.update' account.trigramme %}" method="post">
{% csrf_token %} {% csrf_token %}
{{ user_form.as_p }} {{ user_form.as_p }}
{{ cof_form.as_p }} {{ cof_form.as_p }}

View file

@ -12,16 +12,7 @@
<![endif]--> <![endif]-->
</head> </head>
<body> <body>
<nav> {% include "kfet/base_nav.html" %}
<ul>
<li><a href="{% url "kfet.home" %}">Home</a></li>
{% if perms.kfet.add_account %}
<li>
<a href={% url "kfet.account.create" %}>Créer un compte</a>
</li>
{% endif %}
</ul>
</nav>
<section id="content"> <section id="content">
{% block content %}TGTG{% endblock %} {% block content %}TGTG{% endblock %}
</section> </section>

View file

@ -0,0 +1,20 @@
<nav>
Standard
<ul>
<li><a href="{% url "kfet.home" %}">Home</a></li>
<li>
{% if request.user.profile.account_kfet %}
<a href="{% url "kfet.account.read" request.user.profile.account_kfet.trigramme %}">
Mes infos
</a>
{% endif %}
</li>
</ul>
Equipe
{% if perms.is_team %}
<ul>
<li><a href="{% url "kfet.account" %}">Comptes</a></li>
</ul>
{% endif %}
</nav>

View file

@ -11,7 +11,8 @@ urlpatterns = [
# ----- # -----
# General # General
url(r'^account/$', views.account), url(r'^account/$', views.account,
name = 'kfet.account'),
url(r'^account/is_validandfree$', views.account_is_validandfree_ajax, url(r'^account/is_validandfree$', views.account_is_validandfree_ajax,
name = 'kfet.account.is_validandfree.ajax'), name = 'kfet.account.is_validandfree.ajax'),

View file

@ -199,7 +199,7 @@ def account_update(request, trigramme):
if request.user.has_perm('kfet.change_account'): if request.user.has_perm('kfet.change_account'):
account_form = AccountForm(request.POST, instance = account) account_form = AccountForm(request.POST, instance = account)
else: else:
account_form = AccountRestrictForm(instance = account) account_form = AccountRestrictForm(request.POST, instance = account)
cof_form = CofRestrictForm(request.POST, instance=account.cofprofile) cof_form = CofRestrictForm(request.POST, instance=account.cofprofile)
user_form = UserRestrictForm(request.POST, instance=account.cofprofile.user) user_form = UserRestrictForm(request.POST, instance=account.cofprofile.user)