From 5cc391391ece9b385ac69a39f88fea2e10ae068d Mon Sep 17 00:00:00 2001 From: reverend Date: Wed, 9 Sep 2020 22:52:28 +0200 Subject: [PATCH] More comments --- lostplaces/lostplaces_app/views/base_views.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lostplaces/lostplaces_app/views/base_views.py b/lostplaces/lostplaces_app/views/base_views.py index 4eeded9..65c614d 100644 --- a/lostplaces/lostplaces_app/views/base_views.py +++ b/lostplaces/lostplaces_app/views/base_views.py @@ -12,6 +12,11 @@ from django.urls import reverse_lazy from lostplaces_app.models import Place class IsAuthenticated(LoginRequiredMixin, View): + ''' + A view mixin that checks wether a user is loged in or not. + If the user is not logged in, he gets redirected to + the login page. + ''' redirect_field_name = 'redirect_to' permission_denied_message = 'Please login to proceed' @@ -20,6 +25,12 @@ class IsAuthenticated(LoginRequiredMixin, View): return super().handle_no_permission() class IsPlaceSubmitter(UserPassesTestMixin, View): + ''' + A view mixin that checks wethe a user is the submitter + of a place Throws 403 if the user is not. The subclass + has to provide a get_place method, wich returns the + place to check. + ''' place_submitter_error_message = None def get_place(self):