From 02910384c3bf783e9d18d0e3904a731e4ddba51c Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Tue, 29 Aug 2017 13:29:52 +0200 Subject: [PATCH] Ithenticate try 9 --- submissions/mixins.py | 11 +++++++++++ submissions/views.py | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/submissions/mixins.py b/submissions/mixins.py index 6f82693b1..44cc263a5 100644 --- a/submissions/mixins.py +++ b/submissions/mixins.py @@ -1,3 +1,4 @@ +from django.core.exceptions import ImproperlyConfigured from django.contrib.auth.mixins import PermissionRequiredMixin from django.views.generic.list import ListView @@ -22,6 +23,16 @@ class FriendlyPermissionMixin(PermissionRequiredMixin): class SubmissionFormViewMixin: + def get_success_url(self): + if not self.success_url: + try: + return str(self.get_object().get_absolute_url()) + except: + raise ImproperlyConfigured("No URL to redirect to. Provide a success_url.") + + return str(self.success_url) # success_url may be lazy + + def get_form_kwargs(self): """ Ideally all ModelForms on Submission-related objects have a required argument `submission`. diff --git a/submissions/views.py b/submissions/views.py index cda1c2fdc..8468bdf8c 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -1486,7 +1486,6 @@ class PlagiarismView(SubmissionAdminViewMixin, UpdateView): permission_required = 'scipost.can_do_plagiarism_checks' template_name = 'submissions/admin/plagiarism_report.html' editorial_page = True - success_url = reverse_lazy('submissions:plagiarism') form_class = iThenticateReportForm def get_object(self): -- GitLab