Ejemplo n.º 1
0
 def inner(request, *args, **kwargs):
     if model:
         queryset = model.objects.all()
     else:
         queryset = None
     kwargs['slug_field'] = 'user__username'
     if not generic_permission_check(queryset, perm, request, *args, **kwargs):
         if request.user.is_authenticated():
             raise Http403
         else:
             return redirect_to_login(request.path)
     return fn(request, *args, **kwargs)
Ejemplo n.º 2
0
 def inner(request, *args, **kwargs):
     if not isinstance(kwargs['author'], User):
         author = get_object_or_404(User, username=kwargs['author'])
     else:
         author = kwargs['author']
     if model:
         queryset = model.objects.filter(author=author)
     else:
         queryset = None
     if not generic_permission_check(queryset, perm, request, *args, **kwargs):
         if request.user.is_authenticated():
             raise Http403
         else:
             return redirect_to_login(request.path)
     return fn(request, *args, **kwargs)
Ejemplo n.º 3
0
 def inner(request, *args, **kwargs):
     if not isinstance(kwargs['project'], Project):
         project = get_object_or_404(Project, slug=kwargs['project'])
     else:
         project = kwargs['project']
     if model:
         queryset = model.objects.filter(project=project)
     else:
         queryset = None
     if model and not 'slug_field' in kwargs:
         kwargs['slug_field'] = 'title'
     if model and not 'slug' in kwargs:
         kwargs['slug'] = 'index'
     if not generic_permission_check(queryset, perm, request, *args, **kwargs):
         if request.user.is_authenticated():
             raise Http403
         else:
             return redirect_to_login(request.path)
     return fn(request, *args, **kwargs)