From 34ef0865d74ea2686e3740017895740e589b47bb Mon Sep 17 00:00:00 2001 From: Matheus Lins Date: Sat, 10 Sep 2016 03:05:11 -0300 Subject: [PATCH] fixing template curses --- app/templates/home_professor.html | 2 +- courses/templates/course/view.html | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- courses/views.py | 8 ++++++++ 3 files changed, 60 insertions(+), 9 deletions(-) diff --git a/app/templates/home_professor.html b/app/templates/home_professor.html index 1e57693..2bd893f 100644 --- a/app/templates/home_professor.html +++ b/app/templates/home_professor.html @@ -6,7 +6,7 @@
diff --git a/courses/templates/course/view.html b/courses/templates/course/view.html index 2f3b45a..4a97d8f 100644 --- a/courses/templates/course/view.html +++ b/courses/templates/course/view.html @@ -1,16 +1,39 @@ -{% extends 'app/base.html' %} +{% extends 'home_professor.html' %} {% load static i18n permission_tags %} {% block breadcrumbs %} - +
+
+ +
+
{% endblock %} + {% block sidebar %} -
+ +{{block.super}} +
+
+ +
+
+ {% endblock %} {% block content %} -
+ +
@@ -70,4 +94,23 @@

+
+
+

Subjects

+ {% for subject in subjects %} +
+
+

Subject 1

+
+
+ Dummy Info +
+
+ {% endfor %} +
+
+ {% endblock %} + +{% block rightbar %} +{% endblock rightbar %} diff --git a/courses/views.py b/courses/views.py index 7b8b1cd..1303442 100644 --- a/courses/views.py +++ b/courses/views.py @@ -81,6 +81,14 @@ class View(LoginRequiredMixin, generic.DetailView): context_object_name = 'course' template_name = 'course/view.html' + def get_context_data(self, **kwargs): + context = super(View, self).get_context_data(**kwargs) + course = get_object_or_404(Course, slug = self.kwargs.get('slug')) + subjects = Subject.objects.filter(Q(visible=True) | Q(professors__in=[self.request.user]) | Q(course = course)) + context['subjects'] = subjects + + return context + class DeleteView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): allowed_roles = ['professor', 'system_admin'] -- libgit2 0.21.2