diff --git a/core/decorators.py b/core/decorators.py index b5672d7..566624c 100644 --- a/core/decorators.py +++ b/core/decorators.py @@ -48,16 +48,15 @@ def log_decorator(log_action = '', log_resource = ''): def notification_decorator(read = False, message = '', actor = None, users = [], not_action='', not_resource='', resource_link=''): - + def _notification_decorator(view_function): def _decorator(request, *args, **kwargs): #Do something before the call - + response = view_function(request, *args, **kwargs) action = Action.objects.filter(name = not_action) resource = Resource.objects.filter(name = not_resource) - print(resource_link) if action.exists(): action = action[0] else: @@ -68,7 +67,6 @@ def notification_decorator(read = False, message = '', actor = None, users = [], resource = resource[0] else: resource = Resource(name = not_resource, url= resource_link) - print(resource) resource.save() action_resource = Action_Resource.objects.filter(action = action, resource = resource) @@ -82,11 +80,11 @@ def notification_decorator(read = False, message = '', actor = None, users = [], for user in users: notification = Notification(user=user, actor= actor, message=message, action_resource= action_resource) notification.save() - - + + #Do something after the call return response return wraps(view_function)(_decorator) - - return _notification_decorator \ No newline at end of file + + return _notification_decorator diff --git a/core/mixins.py b/core/mixins.py index d2bde1b..743e1fa 100644 --- a/core/mixins.py +++ b/core/mixins.py @@ -47,7 +47,6 @@ class NotificationMixin(object): def createNotification(self, message='', actor=None, users = User.objects.all(), resource_slug='' ,action_name = '', resource_name='', resource_link=''): #the default will be a broadcast action = Action.objects.filter(name = action_name) resource = Resource.objects.filter(slug = resource_slug) - print(message) if action.exists(): action = action[0] else: @@ -76,5 +75,4 @@ class NotificationMixin(object): def dispatch(self, request, *args, **kwargs): """ Not quite sure how to do about it""" - print("testing IF IT REACHES HERE") - return super(NotificationMixin, self).dispatch(request, *args, **kwargs) \ No newline at end of file + return super(NotificationMixin, self).dispatch(request, *args, **kwargs) diff --git a/core/views.py b/core/views.py index a6ff906..07bfe59 100644 --- a/core/views.py +++ b/core/views.py @@ -102,7 +102,7 @@ def processNotification(self, notificationId): def getNotifications(request): context = {} if request.user.is_authenticated: - + steps = int(request.GET['steps']) amount = int(request.GET['amount']) notifications = Notification.objects.filter(user= request.user, read=False).order_by('-datetime')[steps:steps+amount] @@ -110,18 +110,6 @@ def getNotifications(request): else: #go to login page return HttpResponse('teste') - + html = render_to_string("notifications.html", context) - print(html) return HttpResponse(html) - - - - -# class LoginClass(LoginView): -# template_name='index.html' -# -# def get_context_data(self, **kwargs): -# context = super(LoginClass,self).get_context_data(**kwargs) -# print ("deu certo") -# return context diff --git a/courses/templates/category/create.html b/courses/templates/category/create.html index efd4208..9c5a9a8 100644 --- a/courses/templates/category/create.html +++ b/courses/templates/category/create.html @@ -1,4 +1,4 @@ -{% extends 'app/base.html' %} +{% extends 'base.html' %} {% load static i18n permission_tags %} {% load widget_tweaks %} diff --git a/courses/templates/category/delete.html b/courses/templates/category/delete.html index 3080090..81e4af4 100644 --- a/courses/templates/category/delete.html +++ b/courses/templates/category/delete.html @@ -1,4 +1,4 @@ -{% extends 'app/base.html' %} +{% extends 'base.html' %} {% load static i18n %} {% load static i18n permission_tags %} diff --git a/courses/templates/category/index.html b/courses/templates/category/index.html index 3c6ac24..24c5e29 100644 --- a/courses/templates/category/index.html +++ b/courses/templates/category/index.html @@ -1,4 +1,4 @@ -{% extends 'app/base.html' %} +{% extends 'base.html' %} {% load static i18n %} {% load static i18n permission_tags %} diff --git a/courses/templates/category/update.html b/courses/templates/category/update.html index 55c6031..d173015 100644 --- a/courses/templates/category/update.html +++ b/courses/templates/category/update.html @@ -1,4 +1,4 @@ -{% extends 'app/base.html' %} +{% extends 'base.html' %} {% load static i18n %} {% load static i18n permission_tags %} diff --git a/courses/templates/category/view.html b/courses/templates/category/view.html index 37a74c4..378355f 100644 --- a/courses/templates/category/view.html +++ b/courses/templates/category/view.html @@ -1,4 +1,4 @@ -{% extends 'app/base.html' %} +{% extends 'base.html' %} {% load static i18n permission_tags %} {% load widget_tweaks %} diff --git a/courses/tests/test_topic.py b/courses/tests/test_topic.py index 159a71b..b7ea96e 100644 --- a/courses/tests/test_topic.py +++ b/courses/tests/test_topic.py @@ -85,7 +85,6 @@ class TopicTestCase(TestCase): def test_topic_update(self): self.client.login(username='professor', password='testing') - print (self.subject.topics.all()) url = reverse('course:update_topic',kwargs={'slug':self.subject.topics.all()[0].slug}) data = { "name": 'new name', diff --git a/courses/views.py b/courses/views.py index 0b90819..42f8b36 100644 --- a/courses/views.py +++ b/courses/views.py @@ -40,9 +40,9 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): else: list_courses = Course.objects.filter(students__name = self.request.user.name) categorys_courses = CourseCategory.objects.filter(course_category__students__name = self.request.user.name).distinct() - + courses_category = Course.objects.filter(category__name = self.request.GET.get('category')) - + none = None q = self.request.GET.get('category', None) if q is None: @@ -58,7 +58,7 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): list_courses = paginator.page(1) except EmptyPage: list_courses = paginator.page(paginator.num_pages) - + context['courses_category'] = courses_category context['list_courses'] = list_courses context['categorys_courses'] = categorys_courses @@ -74,7 +74,6 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): object_list = Course.objects.filter(name__icontains = name) else: object_list = Course.objects.all() - print(object_list) return object_list class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,generic.edit.CreateView): @@ -159,7 +158,6 @@ class DeleteCourseView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView): elif has_role(self.request.user,'professor'): courses = self.request.user.courses.all() context['courses'] = courses - print (courses,"jdhksjbjs") context['title'] = course.name return context @@ -198,15 +196,15 @@ class CourseView(LoginRequiredMixin, NotificationMixin, generic.DetailView): categorys_subjects = CategorySubject.objects.filter(subject_category__professors__name = self.request.user.name).distinct() else: categorys_subjects = CategorySubject.objects.filter(subject_category__students__name = self.request.user.name).distinct() - + subjects_category = Subject.objects.filter(category__name = self.request.GET.get('category')) - + none = None q = self.request.GET.get('category', None) if q is None: none = True context['none'] = none - + context['subjects_category'] = subjects_category context['categorys_subjects'] = categorys_subjects context['courses'] = courses @@ -329,14 +327,14 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): else: context['files'] = TopicFile.objects.filter(students__name = self.request.user.name) return context - + class UploadMaterialView(LoginRequiredMixin, generic.edit.CreateView): - login_url = reverse_lazy("core:home") + login_url = reverse_lazy("core:home") redirect_field_name = 'next' template_name = 'files/create_file.html' form_class = FileForm - + def form_invalid(self, form): context = super(UploadMaterialView, self).form_invalid(form) context.status_code = 400 @@ -345,7 +343,7 @@ class UploadMaterialView(LoginRequiredMixin, generic.edit.CreateView): def get_success_url(self): self.success_url = reverse('course:view_subject', args = (self.object.slug, )) - + return self.success_url class TopicsView(LoginRequiredMixin, generic.ListView): diff --git a/exam/views.py b/exam/views.py index 7ab1fd7..ff98fdf 100644 --- a/exam/views.py +++ b/exam/views.py @@ -67,7 +67,6 @@ class ViewExam(LoginRequiredMixin,generic.DetailView): context['answers'] = answers context['keys'] = keys - print (context) return context @@ -170,7 +169,6 @@ class UpdateExam(LoginRequiredMixin,HasRoleMixin,generic.UpdateView): answers = {} for answer in exam.answers.all(): - # print (key.answer) answers[answer.order] = answer.answer keys = sorted(answers) diff --git a/poll/views.py b/poll/views.py index 6006c6d..38984bb 100644 --- a/poll/views.py +++ b/poll/views.py @@ -34,7 +34,6 @@ class ViewPoll(LoginRequiredMixin,generic.DetailView): context['subject'] = poll.topic.subject context['subjects'] = poll.topic.subject.course.subjects.all() answered = AnswersStudent.objects.filter(poll = poll, student=self.request.user) - print (answered) if answered.count()<1: context['status'] = False else: @@ -144,12 +143,8 @@ class UpdatePoll(LoginRequiredMixin,HasRoleMixin,generic.UpdateView): context['course'] = poll.topic.subject.course context['subject'] = poll.topic.subject context['subjects'] = poll.topic.subject.course.subjects.all() - - print (self.request.user) - answers = {} for answer in poll.answers.all(): - # print (key.answer) answers[answer.order] = answer.answer keys = sorted(answers) @@ -215,7 +210,6 @@ class AnswerStudentPoll(LoginRequiredMixin,generic.CreateView): def get_context_data(self, **kwargs): context = super(AnswerStudentPoll, self).get_context_data(**kwargs) - print (self.kwargs.get('slug')) poll = get_object_or_404(Poll, slug = self.kwargs.get('slug')) context['poll'] = poll context['topic'] = poll.topic @@ -223,7 +217,6 @@ class AnswerStudentPoll(LoginRequiredMixin,generic.CreateView): context['subject'] = poll.topic.subject context['subjects'] = poll.topic.subject.course.subjects.all() - print (self.request.method) answers = {} for answer in poll.answers.all(): answers[answer.order] = answer.answer -- libgit2 0.21.2