fixed deletion of motions. #391
This commit is contained in:
parent
57d591fee8
commit
413cd27d40
@ -426,10 +426,13 @@ class MotionDelete(DeleteView):
|
|||||||
"""
|
"""
|
||||||
Delete one or more Motions.
|
Delete one or more Motions.
|
||||||
"""
|
"""
|
||||||
permission_required = 'motion.can_manage_motion'
|
|
||||||
model = Motion
|
model = Motion
|
||||||
url = 'motion_overview'
|
url = 'motion_overview'
|
||||||
|
|
||||||
|
def has_permission(self, request, *args, **kwargs):
|
||||||
|
self.kwargs = kwargs
|
||||||
|
return self.get_object().get_allowed_actions(request.user)
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
self.motions = []
|
self.motions = []
|
||||||
|
|
||||||
|
@ -80,14 +80,14 @@ class LoginMixin(object):
|
|||||||
class PermissionMixin(object):
|
class PermissionMixin(object):
|
||||||
permission_required = NO_PERMISSION_REQUIRED
|
permission_required = NO_PERMISSION_REQUIRED
|
||||||
|
|
||||||
def has_permission(self, request):
|
def has_permission(self, request, *args, **kwargs):
|
||||||
if self.permission_required == NO_PERMISSION_REQUIRED:
|
if self.permission_required == NO_PERMISSION_REQUIRED:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return request.user.has_perm(self.permission_required)
|
return request.user.has_perm(self.permission_required)
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
if not self.has_permission(request):
|
if not self.has_permission(request, *args, **kwargs):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
path = request.get_full_path()
|
path = request.get_full_path()
|
||||||
return HttpResponseRedirect("%s?next=%s" % (settings.LOGIN_URL,
|
return HttpResponseRedirect("%s?next=%s" % (settings.LOGIN_URL,
|
||||||
|
Loading…
Reference in New Issue
Block a user