repalce rapid - long
This commit is contained in:
+4
-4
@@ -1,10 +1,10 @@
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from .models import Rapid
|
||||
from .models import Long
|
||||
|
||||
def user_is_author_or_rapid_checker(function):
|
||||
def user_is_author_or_long_checker(function):
|
||||
def wrap(request, *args, **kwargs):
|
||||
rapid = Rapid.objects.get(pk=kwargs['pk'])
|
||||
if request.user in rapid.author.all() or request.user.groups.filter(name='rapid_checker').exists():
|
||||
long = Long.objects.get(pk=kwargs['pk'])
|
||||
if request.user in long.author.all() or request.user.groups.filter(name='long_checker').exists():
|
||||
return function(request, *args, **kwargs)
|
||||
else:
|
||||
raise PermissionDenied
|
||||
|
||||
Reference in New Issue
Block a user