Fix Page locking

This commit is contained in:
Skia
2016-11-05 13:37:30 +01:00
parent c0c8b295ba
commit 59f5917b8c
6 changed files with 56 additions and 24 deletions

View File

@ -37,6 +37,12 @@ class CanCreateMixin(View):
This view is made to protect any child view that would create an object, and thus, that can not be protected by any
of the following mixin
"""
def dispatch(self, request, *arg, **kwargs):
res = super(CanCreateMixin, self).dispatch(request, *arg, **kwargs)
if not request.user.is_authenticated():
raise PermissionDenied
return res
def form_valid(self, form):
obj = form.instance
if can_edit_prop(obj, self.request.user):