p = PageStatique.objects.get(id='groupes')
entete = p.contenu
except PageStatique.DoesNotExist:
- entete = '<h1>Groupes</h1>'
+ entete = '<h1>Liste des groupes</h1>'
+
+ if request.user.is_authenticated():
+ chercheur = Chercheur.objects.get(courriel=request.user.email)
+ mesgroupes = chercheur.groupes.all().filter(chercheurgroupe__actif=1)
+ else:
+ mesgroupes = None
return render_to_response("chercheurs/groupe_index.html", dict(
search_form=search_form, groupes=groupes.order_by('nom'),
- nb_resultats=nb_resultats, entete=entete
+ nb_resultats=nb_resultats, entete=entete, mesgroupes=mesgroupes,
), context_instance=RequestContext(request))
def groupe_retrieve(request, id):
{{ entete|safe }}
+<div style="clear:both;width:400px;float:left;padding-right:20px;">
<h2>Recherche</h2>
<form method="get" action="">
<table>
- {% with search_form as form %}
- {% include "render_form.html" %}
- {% endwith %}
- <tr><th></th><td><input type="submit" class="bouton" value="Rechercher" /></td></tr>
+ <tr>
+ {% for field in search_form %}
+ {% if field.is_hidden %}
+ {{ field }}
+ {% else %}
+ <td>{{ field }}</td>
+ {% endif %}
+ {% endfor %}
+ <td><input type="submit" class="bouton" value="Rechercher" /></td>
+ </tr>
</table>
</form>
</div>
<div class="pagination">{% paginate %}</div>
-{% for groupe in groupes %}
-<div class="resultatRecherche">
- <div class="titre">
- <a href="{% url chercheurs.views.groupe_retrieve groupe.id %}">{{ groupe.nom }}</a>
- </div>
-</div>
-{% empty %}
+{% if groupes %}
+<ul>
+{% for groupe in groupes %}
+<li><a href="{% url chercheurs.views.groupe_retrieve groupe.id %}">{{ groupe.nom }}</a></li>
+{% endfor %}
+</ul>
+{% else %}
<div class="resultatRecherche">
<h2>Aucun résultat trouvé</h2>
</div>
-{% endfor %}
+{% endif %}
<div class="pagination">{% paginate %}</div>
+</div>
+
+{% if mesgroupes %}
+<div style="float:left;">
+<h2>Mes groupes</h2>
+<ul>
+{% for groupe in mesgroupes %}
+<li><a href="{% url chercheurs.views.groupe_retrieve groupe.id %}">{{ groupe.nom }}</a></li>
+{% endfor %}
+</ul>
+</div>
+{% endif %}
+
+<div style="clear:both;"></div>
+
{% endblock %}