Commit e4ae9d4b3c862c0b343da13aa42013c7d48f469c

Authored by fbormann
1 parent 63bf2a8e

teste

Showing 1 changed file with 4 additions and 34 deletions   Show diff stats
courses/views.py
@@ -586,12 +586,7 @@ class UploadMaterialView(LoginRequiredMixin, generic.edit.CreateView): @@ -586,12 +586,7 @@ class UploadMaterialView(LoginRequiredMixin, generic.edit.CreateView):
586 586
587 return self.success_url 587 return self.success_url
588 588
589 -class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView):  
590 -  
591 - log_component = "subject"  
592 - log_resource = "topic"  
593 - log_action = "viewed"  
594 - log_context = {} 589 +class TopicsView(LoginRequiredMixin, generic.ListView):
595 590
596 login_url = reverse_lazy("core:home") 591 login_url = reverse_lazy("core:home")
597 redirect_field_name = 'next' 592 redirect_field_name = 'next'
@@ -620,7 +615,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): @@ -620,7 +615,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView):
620 activitys = Activity.objects.filter(topic__name = topic.name) 615 activitys = Activity.objects.filter(topic__name = topic.name)
621 students_activit = User.objects.filter(activities__in = Activity.objects.all()) 616 students_activit = User.objects.filter(activities__in = Activity.objects.all())
622 materials = Material.objects.filter(topic = topic) 617 materials = Material.objects.filter(topic = topic)
623 - 618 + print(materials)
624 context['topic'] = topic 619 context['topic'] = topic
625 context['subject'] = topic.subject 620 context['subject'] = topic.subject
626 context['activitys'] = activitys 621 context['activitys'] = activitys
@@ -628,26 +623,12 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): @@ -628,26 +623,12 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView):
628 context['materials'] = materials 623 context['materials'] = materials
629 context['form'] = ActivityForm 624 context['form'] = ActivityForm
630 625
631 -  
632 626
633 - self.log_context['subject_id'] = topic.subject.id  
634 - self.log_context['subject_name'] = topic.subject.name  
635 - self.log_context['subject_slug'] = topic.subject.slug  
636 - self.log_context['topic_id'] = topic.id  
637 - self.log_context['topic_name'] = topic.name  
638 - self.log_context['topic_slug'] = topic.slug  
639 -  
640 - super(TopicsView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context)  
641 -  
642 - 627 +
643 return context 628 return context
644 629
645 630
646 -class CreateTopicView(LoginRequiredMixin, LogMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView):  
647 - log_component = "subject"  
648 - log_resource = "topic"  
649 - log_action = "created"  
650 - log_context = {} 631 +class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView):
651 632
652 allowed_roles = ['professor', 'system_admin'] 633 allowed_roles = ['professor', 'system_admin']
653 login_url = reverse_lazy("core:home") 634 login_url = reverse_lazy("core:home")
@@ -664,8 +645,6 @@ class CreateTopicView(LoginRequiredMixin, LogMixin, HasRoleMixin, NotificationMi @@ -664,8 +645,6 @@ class CreateTopicView(LoginRequiredMixin, LogMixin, HasRoleMixin, NotificationMi
664 context['course'] = subject.course 645 context['course'] = subject.course
665 context['subject'] = subject 646 context['subject'] = subject
666 context['subjects'] = subject.course.subjects.all() 647 context['subjects'] = subject.course.subjects.all()
667 -  
668 -  
669 return context 648 return context
670 649
671 def form_valid(self, form): 650 def form_valid(self, form):
@@ -679,16 +658,7 @@ class CreateTopicView(LoginRequiredMixin, LogMixin, HasRoleMixin, NotificationMi @@ -679,16 +658,7 @@ class CreateTopicView(LoginRequiredMixin, LogMixin, HasRoleMixin, NotificationMi
679 super(CreateTopicView, self).createNotification("Topic "+ self.object.name + " was created", 658 super(CreateTopicView, self).createNotification("Topic "+ self.object.name + " was created",
680 resource_name=self.object.name, resource_link= reverse('course:view_topic',args=[self.object.slug]), 659 resource_name=self.object.name, resource_link= reverse('course:view_topic',args=[self.object.slug]),
681 actor=self.request.user, users = self.object.subject.course.students.all() ) 660 actor=self.request.user, users = self.object.subject.course.students.all() )
682 -  
683 661
684 - self.log_context['subject_id'] = subject.id  
685 - self.log_context['subject_name'] = subject.name  
686 - self.log_context['subject_slug'] = subject.slug  
687 - self.log_context['topic_id'] = self.object.id  
688 -  
689 - super(CreateTopicView, self).createLog(self.request.user, self.log_component,  
690 - self.log_action, self.log_resource, self.log_context)  
691 -  
692 return super(CreateTopicView, self).form_valid(form) 662 return super(CreateTopicView, self).form_valid(form)
693 663
694 class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): 664 class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView):