From e62359e4faa5290a692b2cc8e0f5b9e522ad784b Mon Sep 17 00:00:00 2001 From: Klafyvel Date: Fri, 2 Mar 2018 10:02:54 +0100 Subject: [PATCH] Affichage de plus d'information sur la page admin --- settings/templates/settings/settings.html | 4 ++++ users/models.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/settings/templates/settings/settings.html b/settings/templates/settings/settings.html index 267058d..e32510e 100644 --- a/settings/templates/settings/settings.html +++ b/settings/templates/settings/settings.html @@ -43,12 +43,16 @@ Nom Nombre de membres + Nombre de contenus + Nombre de catégories Numéro de téléphone {% for school in schools %} {{school.group.name}} {{school.group.user_set.count}} + {{school.content_set.count}} + {{school.number_of_categories}} {{school.phone}} diff --git a/users/models.py b/users/models.py index 45b251b..577dfb0 100644 --- a/users/models.py +++ b/users/models.py @@ -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(