Affichage des écoles

This commit is contained in:
Klafyvel 2018-02-28 22:16:53 +01:00
parent 95895d23f1
commit 09b06e1b9d
3 changed files with 30 additions and 0 deletions

View file

@ -16,6 +16,9 @@
</ul>
<ul class="navbar-nav ml-auto">
{% if request.user.userprofile.school %}
<li class="nav-item {% if school %}active{% endif %}"><a class="nav-link" href="{% url 'users:school' request.user.userprofile.school.pk %}"><i class="fas fa-graduation-cap"></i> Mon école</a></li>
{% endif %}
<li class="nav-item {% if settings %}active{% endif %}"><a class="nav-link" href="{% url 'settings:index' %}"><i class="fas fa-cogs"></i> Administration</a></li>
{% if request.user.is_authenticated %}
<li class="nav-item dropdown">

View file

@ -7,6 +7,29 @@
<i class="fa fa-edit"></i>
Éditer
</a>
<h2>Membres</h2>
<table class="table table-striped">
<thead>
<th>Nom</th>
<th>Prénom</th>
<th>Pseudo</th>
<th>Administrer</th>
</thead>
<tbody>
{% for member in members %}
<td>{{member.last_name}}</td>
<td>{{member.first_name}}</td>
<td>{{member.username}}</td>
<td>
<a class="btn btn-outline-warning btn-sm" href="">
<i class="fa fa-trash"></i>
Supprimer
</a>
</td>
{% endfor %}
</tbody>
</table>
<h2>Contenus</h2>
<a class="btn btn-success btn-sm" href="{% url 'content:content-new' %}">
<i class="fa fa-plus"></i>
Ajouter un contenu
@ -18,4 +41,6 @@
{% include "content/content.html" %}
{%endfor%}
</div>
<br />
<br />
{% endblock %}

View file

@ -124,6 +124,8 @@ class School(DetailView):
def get_context_data(self, **kwargs):
context = super().get_context_data()
context['contents'] = Content.objects.filter(school_owner=self.object)
context['school'] = True
context['members'] = User.objects.filter(userprofile__school=self.object)
return context