diff --git a/subjects/static/subjects/js/modal_subject.js b/subjects/static/subjects/js/modal_subject.js index 27d7c9a..18d2ea7 100644 --- a/subjects/static/subjects/js/modal_subject.js +++ b/subjects/static/subjects/js/modal_subject.js @@ -56,7 +56,7 @@ var SubscribeSubject = { $('body').removeClass('modal-open'); $("#modal_course").empty(); $(".modal-backdrop.in").remove(); - alertify.success("Subscription was succesfull!"); + window.location.href = data['url']; }).fail(function(){ $("#modal_course").empty(); $("#modal_course").append(data); diff --git a/subjects/views.py b/subjects/views.py index 626e120..7a8ebf5 100644 --- a/subjects/views.py +++ b/subjects/views.py @@ -278,11 +278,11 @@ class SubjectSubscribeView(LoginRequiredMixin, TemplateView): def post(self, request, *args, **kwargs): subject = get_object_or_404(Subject, slug= kwargs.get('slug')) - print(subject) subject.students.add(request.user) subject.save() + messages.success(self.request, _('Subscription was successfull!')) - return HttpResponse('success') + return JsonResponse({'url':reverse_lazy('subjects:index')}) -- libgit2 0.21.2