From d0f762481e923d40b9904474dab2fea6cb0c062f Mon Sep 17 00:00:00 2001 From: Matheus Lins Date: Sat, 1 Oct 2016 18:35:35 -0300 Subject: [PATCH] updating view course in teacher --- courses/templates/course/index.html | 30 +++++++++++++++--------------- courses/templates/course/view.html | 294 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------- courses/views.py | 5 +++-- 3 files changed, 219 insertions(+), 110 deletions(-) diff --git a/courses/templates/course/index.html b/courses/templates/course/index.html index 4a27735..11eede5 100644 --- a/courses/templates/course/index.html +++ b/courses/templates/course/index.html @@ -56,8 +56,8 @@ {% if user|has_role:'professor, system_admin' %}
- {% if subjects_student|length > 0 %} - {% for subject in subjects_teacher %} + {% if courses_teacher|length > 0 %} + {% for course in courses_teacher %}
@@ -66,7 +66,7 @@
@@ -81,7 +81,7 @@ @@ -91,13 +91,13 @@
-

Course Name: {{subject.name}}

+

Course Name: {{course.name}}

Duration (in semesters): 09

-

Coordinator: {{subject.professors}}

+

Coordinator: {{course.professors}}

Description: - {{subject.description}} + {{course.description}}

@@ -146,7 +146,7 @@
{% if subjects_student|length > 0 %} - {% for subject in subjects_student %} + {% for course in courses_student %}

Course

- {{ subject.category }} - {{ subject.max_students }} {% trans 'students tops' %} + {{ course.category }} + {{ course.max_students }} {% trans 'students tops' %}
-

Course Name: {{ subject.name }}

+

Course Name: {{ course.name }}

Duration (in semesters): 09

-

Coordinator: {{subject.professors}}

+

Coordinator: {{course.professors}}

Description: @@ -171,15 +171,15 @@

{% if user|has_role:'professor, system_admin' %} - + - + {% endif %} - View Course + View Course
diff --git a/courses/templates/course/view.html b/courses/templates/course/view.html index 4d14f64..4e4e5fb 100644 --- a/courses/templates/course/view.html +++ b/courses/templates/course/view.html @@ -15,120 +15,206 @@ {% endblock %} {% block sidebar %} -
-
- -
-
-
- + -
- -
-
- -
-
- -
+ +{% if user|has_role:'professor, system_admin' %} + + - -
-{% if courses.count > 0 %} -
-
-
{% trans "Courses" %}
-
-
- -
{% endif %} + {% endblock %} {% block content %} -
-
-
-
-

{{course.name}}

-
-
- {% if user|has_role:'professor, system_admin' %} - -
- - +
+
+
+
+
+

{{course}}

+
+
+
+ +
+
- {% endif %} -
+
+
+

Course Name: {{course.name}}

+

Duration (in semesters): 09

+

Coordinator: {{course.professors}}

+

+ Description: + + {{course.description}} + +

+ +
-
-

Course Name: {{course.name}}

-

Duration (in semesters):

- {% for professor in course.professors.all %} -

Professor: {{professor.name}}

- {% endfor %} - -

- Description: - - {{course.content}} - -

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

{% trans "Professor" %}: {% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}

@@ -146,11 +232,33 @@

-
+
{% endfor %} - - - + + + + +
+
+
+ {% endblock %} diff --git a/courses/views.py b/courses/views.py index 7d13b1f..93bd033 100644 --- a/courses/views.py +++ b/courses/views.py @@ -24,13 +24,14 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): redirect_field_name = 'next' queryset = Course.objects.all() template_name = 'course/index.html' - context_object_name = 'subjects_student' + context_object_name = 'courses_student' paginate_by = 3 def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) context['categories'] = Category.objects.all() - context['subjects_teacher'] = Course.objects.filter(professors__name = self.request.user.name) + context['courses_teacher'] = Course.objects.filter(professors__name = self.request.user.name) + return context class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,generic.edit.CreateView): -- libgit2 0.21.2