From e6636f13c0adc604f0cdce3a6fe661ca915fa872 Mon Sep 17 00:00:00 2001 From: Zambom Date: Mon, 21 Aug 2017 22:49:35 -0300 Subject: [PATCH] Adding non-student view in pendencies (subject template) --- goals/templates/goals/view.html | 2 +- goals/views.py | 4 ++-- notifications/templates/notifications/_history.html | 15 ++++++++------- notifications/templates/notifications/subject.html | 37 +++++++++++++++++++++++++++++++++++-- notifications/templatetags/notification_filters.py | 24 ++++++++++++++++++++---- notifications/views.py | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 6 files changed, 146 insertions(+), 21 deletions(-) diff --git a/goals/templates/goals/view.html b/goals/templates/goals/view.html index 319057d..c69edb0 100644 --- a/goals/templates/goals/view.html +++ b/goals/templates/goals/view.html @@ -33,7 +33,7 @@ {% endif %} {% resource_permissions request.user goal as has_resource_permissions %} - {% subject_permissions request.user goal as has_subject_permissions %} + {% subject_permissions request.user goal.topic.subject as has_subject_permissions %} {% if goal.visible %}
diff --git a/goals/views.py b/goals/views.py index b5ffee0..25274f2 100644 --- a/goals/views.py +++ b/goals/views.py @@ -215,7 +215,7 @@ class InsideView(LoginRequiredMixin, LogMixin, generic.ListView): slug = self.kwargs.get('slug', '') goal = get_object_or_404(Goals, slug = slug) - if has_subject_permissions(self.request.user, goal): + if has_subject_permissions(self.request.user, goal.topic.subject): self.students = User.objects.filter(subject_student = goal.topic.subject).order_by('social_name', 'username') goals = MyGoals.objects.filter(user = self.students.first(), item__goal = goal) @@ -230,7 +230,7 @@ class InsideView(LoginRequiredMixin, LogMixin, generic.ListView): user = request.POST.get('selected_student', None) - if has_subject_permissions(request.user, goal): + if has_subject_permissions(request.user, goal.topic.subject): self.students = User.objects.filter(subject_student = goal.topic.subject).order_by('social_name', 'username') if not user is None: diff --git a/notifications/templates/notifications/_history.html b/notifications/templates/notifications/_history.html index d37d273..f2d606e 100644 --- a/notifications/templates/notifications/_history.html +++ b/notifications/templates/notifications/_history.html @@ -7,6 +7,7 @@
+
@@ -18,37 +19,37 @@ diff --git a/notifications/templates/notifications/subject.html b/notifications/templates/notifications/subject.html index e09cfe7..4b6de29 100644 --- a/notifications/templates/notifications/subject.html +++ b/notifications/templates/notifications/subject.html @@ -10,6 +10,8 @@ {% endblock %} {% block content %} + {% subject_permissions request.user subject as has_subject_permissions %} + {% if subject.visible %}
@@ -26,11 +28,36 @@
- + {% trans 'Date' %} - + {% trans 'Resource' %} - + {% trans 'Task' %} - + {% trans 'Final Date' %} - + {% trans 'Notification' %} - + {% trans 'Aware' %} - + {% trans 'Observation' %}