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>
<ul class="navbar-nav ml-auto"> <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> <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 %} {% if request.user.is_authenticated %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">

View file

@ -7,6 +7,29 @@
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
Éditer Éditer
</a> </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' %}"> <a class="btn btn-success btn-sm" href="{% url 'content:content-new' %}">
<i class="fa fa-plus"></i> <i class="fa fa-plus"></i>
Ajouter un contenu Ajouter un contenu
@ -18,4 +41,6 @@
{% include "content/content.html" %} {% include "content/content.html" %}
{%endfor%} {%endfor%}
</div> </div>
<br />
<br />
{% endblock %} {% endblock %}

View file

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