From 746fea4a7f50f35393bc959fbefe500277b5bd6a Mon Sep 17 00:00:00 2001 From: Zambom Date: Fri, 13 Jan 2017 17:28:23 -0200 Subject: [PATCH] Adjusting subject count per cactegory --- subjects/templatetags/subject_counter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/subjects/templatetags/subject_counter.py b/subjects/templatetags/subject_counter.py index 1d4e59a..631b9ed 100644 --- a/subjects/templatetags/subject_counter.py +++ b/subjects/templatetags/subject_counter.py @@ -6,8 +6,11 @@ register = template.Library() def subject_count(category, user): total = 0 - for subject in category.subject_category.all(): - if user in subject.students.all() or user in subject.professor.all() or user in subject.category.coordinators.all(): - total += 1 + if not user.is_staff: + for subject in category.subject_category.all(): + if user in subject.students.all() or user in subject.professor.all() or user in subject.category.coordinators.all(): + total += 1 + else: + total = category.subject_category.count() return total \ No newline at end of file -- libgit2 0.21.2