repalce rapid - long

This commit is contained in:
Ross
2021-02-02 09:35:29 +00:00
parent 38134e5fbc
commit b681a27640
28 changed files with 276 additions and 276 deletions
+4 -4
View File
@@ -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