Commit 682b707b5fe859b99afe79669718c8f664e1eba8
1 parent
ac8d65c0
Exists in
master
and in
5 other branches
view delivery exercises #92
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
courses/views.py
... | ... | @@ -12,7 +12,7 @@ from django.db.models import Q |
12 | 12 | from rolepermissions.verifications import has_object_permission |
13 | 13 | |
14 | 14 | from .forms import CourseForm, UpdateCourseForm, CategoryForm, SubjectForm,TopicForm |
15 | -from .models import Course, Subject, Category,Topic, SubjectCategory | |
15 | +from .models import Course, Subject, Category,Topic, SubjectCategory,Activity | |
16 | 16 | from core.mixins import NotificationMixin |
17 | 17 | from users.models import User |
18 | 18 | |
... | ... | @@ -282,16 +282,20 @@ class TopicsView(LoginRequiredMixin, generic.ListView): |
282 | 282 | def get_queryset(self): |
283 | 283 | topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) |
284 | 284 | subject = topic.subject |
285 | - context = Topic.objects.filter(subject = subject, visible=True) | |
285 | + topics_q = Topic.objects.filter(subject = subject, visible=True) | |
286 | 286 | #if (self.request.user in subject.professors.all() or has_role(self.request.user,'system_admin')): |
287 | 287 | #context = subject.topics.all() <- Change it By Activities |
288 | - return context | |
288 | + return topics_q | |
289 | 289 | |
290 | 290 | def get_context_data(self, **kwargs): |
291 | 291 | topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) |
292 | 292 | context = super(TopicsView, self).get_context_data(**kwargs) |
293 | + activitys = Activity.objects.filter(topic__name = topic.name) | |
294 | + students_activit = User.objects.filter(activities = Activity.objects.all()) | |
293 | 295 | context['topic'] = topic |
294 | 296 | context['subject'] = topic.subject |
297 | + context['activitys'] = activitys | |
298 | + context['students_activit'] = students_activit | |
295 | 299 | return context |
296 | 300 | |
297 | 301 | class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView): | ... | ... |