Affichage de plus d'information sur la page admin
This commit is contained in:
parent
0c75f32c5f
commit
e62359e4fa
2 changed files with 8 additions and 1 deletions
|
@ -43,12 +43,16 @@
|
|||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Nombre de membres</th>
|
||||
<th>Nombre de contenus</th>
|
||||
<th>Nombre de catégories</th>
|
||||
<th>Numéro de téléphone</th>
|
||||
<th></th>
|
||||
{% for school in schools %}
|
||||
<tr>
|
||||
<th>{{school.group.name}}</th>
|
||||
<td>{{school.group.user_set.count}}</td>
|
||||
<td>{{school.content_set.count}}</td>
|
||||
<td>{{school.number_of_categories}}</td>
|
||||
<td>{{school.phone}}</td>
|
||||
<td><a class="btn btn-outline-primary btn-sm" href="{% url "users:edit-school-name" pk=school.group.pk%}">
|
||||
<i class="fas fa-edit"></i>
|
||||
|
|
|
@ -36,7 +36,10 @@ class SchoolProfile(models.Model):
|
|||
return self.group.name
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("users:school", kwargs={'pk':self.pk})
|
||||
return reverse("users:school", kwargs={'pk':self.group.pk})
|
||||
|
||||
def number_of_categories(self):
|
||||
return self.content_set.values('category').distinct().count()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
viewing_right, _ = Permission.objects.get_or_create(
|
||||
|
|
Loading…
Reference in a new issue