Compare commits

...

2 Commits

Author SHA1 Message Date
bb1dafc89c Dev dep 2020-09-09 22:53:22 +02:00
5cc391391e More comments 2020-09-09 22:52:28 +02:00
2 changed files with 13 additions and 1 deletions

View File

@ -6,6 +6,8 @@ verify_ssl = true
[dev-packages]
pylint = "*"
coverage = "*"
autopep8 = "*"
pipenv = "*"
[packages]
django = "*"
@ -13,7 +15,6 @@ easy-thumbnails = "*"
image = "*"
django-widget-tweaks = "*"
django-taggit = "*"
# Commented out to not explicitly specify Python 3 subversion.
# [requires]
# python_version = "3.8"

View File

@ -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):