diff --git a/smash/web/middleware.py b/smash/web/middleware.py index 88bfbd5022bbe835fa1ddff88e519fbe596c2346..b56147a43923101b2f82b66c8bb4445ebac0bba2 100644 --- a/smash/web/middleware.py +++ b/smash/web/middleware.py @@ -22,7 +22,10 @@ class PrivacyNoticeMiddleware(MiddlewareMixin): worker = Worker.get_by_user(request.user) if worker is None: return None - if study.study_privacy_notice and study.acceptance_of_study_privacy_notice_required and not worker.privacy_notice_accepted: + if study.study_privacy_notice \ + and study.acceptance_of_study_privacy_notice_required \ + and not worker.privacy_notice_accepted\ + and study.study_privacy_notice.document.url != request.path: messages.add_message(request, messages.WARNING, "You can't use the system until you accept the privacy notice.") #return reverse_lazy('web.views.accept_privacy_notice', kwargs={'pk': study.study_privacy_notice}) return redirect(reverse('web.views.accept_privacy_notice', kwargs={'pk': study.study_privacy_notice.id}))