mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-01 07:26:03 +02:00
available_attrs was removed from Django as it was only used as a Python 2 bug workaround
This commit is contained in:
parent
e50225a67c
commit
f9f975932b
@ -4,7 +4,6 @@ from django.core.exceptions import PermissionDenied
|
|||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
|
|
||||||
from django.utils.decorators import available_attrs
|
|
||||||
from django.contrib.auth.decorators import user_passes_test
|
from django.contrib.auth.decorators import user_passes_test
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ def protect_view(view_func):
|
|||||||
Decorator for protecting the views checking user, redirecting
|
Decorator for protecting the views checking user, redirecting
|
||||||
to the log-in page if necessary or returning 404 status code
|
to the log-in page if necessary or returning 404 status code
|
||||||
"""
|
"""
|
||||||
@wraps(view_func, assigned=available_attrs(view_func))
|
@wraps(view_func)
|
||||||
def _wrapped_view(request, *args, **kwargs):
|
def _wrapped_view(request, *args, **kwargs):
|
||||||
if not request.user.is_authenticated and helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT:
|
if not request.user.is_authenticated and helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT:
|
||||||
return redirect('helpdesk:login')
|
return redirect('helpdesk:login')
|
||||||
@ -64,7 +63,7 @@ def staff_member_required(view_func):
|
|||||||
Decorator for staff member the views checking user, redirecting
|
Decorator for staff member the views checking user, redirecting
|
||||||
to the log-in page if necessary or returning 403
|
to the log-in page if necessary or returning 403
|
||||||
"""
|
"""
|
||||||
@wraps(view_func, assigned=available_attrs(view_func))
|
@wraps(view_func)
|
||||||
def _wrapped_view(request, *args, **kwargs):
|
def _wrapped_view(request, *args, **kwargs):
|
||||||
if not request.user.is_authenticated and not request.user.is_active:
|
if not request.user.is_authenticated and not request.user.is_active:
|
||||||
return redirect('helpdesk:login')
|
return redirect('helpdesk:login')
|
||||||
@ -80,7 +79,7 @@ def superuser_required(view_func):
|
|||||||
Decorator for superuser member the views checking user, redirecting
|
Decorator for superuser member the views checking user, redirecting
|
||||||
to the log-in page if necessary or returning 403
|
to the log-in page if necessary or returning 403
|
||||||
"""
|
"""
|
||||||
@wraps(view_func, assigned=available_attrs(view_func))
|
@wraps(view_func)
|
||||||
def _wrapped_view(request, *args, **kwargs):
|
def _wrapped_view(request, *args, **kwargs):
|
||||||
if not request.user.is_authenticated and not request.user.is_active:
|
if not request.user.is_authenticated and not request.user.is_active:
|
||||||
return redirect('helpdesk:login')
|
return redirect('helpdesk:login')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user