mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 16:03:19 +01:00
Merge pull request #883 from alligatorbait/master
Updates required to work with Django 3.x
This commit is contained in:
commit
35cde5aa0d
@ -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')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load saved_queries %}
|
{% load saved_queries %}
|
||||||
{% load load_helpdesk_settings %}
|
{% load load_helpdesk_settings %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
{% with request|load_helpdesk_settings as helpdesk_settings %}
|
{% with request|load_helpdesk_settings as helpdesk_settings %}
|
||||||
{% with user|saved_queries as user_saved_queries_ %}
|
{% with user|saved_queries as user_saved_queries_ %}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load saved_queries %}
|
{% load saved_queries %}
|
||||||
{% load load_helpdesk_settings %}
|
{% load load_helpdesk_settings %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
{% with request|load_helpdesk_settings as helpdesk_settings %}
|
{% with request|load_helpdesk_settings as helpdesk_settings %}
|
||||||
{% with user|saved_queries as user_saved_queries_ %}
|
{% with user|saved_queries as user_saved_queries_ %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
<!-- jQuery and Bootstrap Core -->
|
<!-- jQuery and Bootstrap Core -->
|
||||||
{% if helpdesk_settings.HELPDESK_USE_CDN %}
|
{% if helpdesk_settings.HELPDESK_USE_CDN %}
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% load i18n humanize %}
|
{% load i18n humanize %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
{% load in_list %}
|
{% load in_list %}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="col col-sm-3">
|
<div class="col col-sm-3">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% load i18n humanize %}
|
{% load i18n humanize %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
{% load in_list %}
|
{% load in_list %}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="col col-sm-3">
|
<div class="col col-sm-3">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% load i18n humanize %}
|
{% load i18n humanize %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
{% load in_list %}
|
{% load in_list %}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="col col-sm-3">
|
<div class="col col-sm-3">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% load i18n humanize %}
|
{% load i18n humanize %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="col col-sm-3">
|
<div class="col col-sm-3">
|
||||||
<label for='id_sort' class="col-form-label">{% trans "Sorting" %}:</label>
|
<label for='id_sort' class="col-form-label">{% trans "Sorting" %}:</label>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% load i18n humanize %}
|
{% load i18n humanize %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
{% load in_list %}
|
{% load in_list %}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="col col-sm-3">
|
<div class="col col-sm-3">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
{% load load_helpdesk_settings %}
|
{% load load_helpdesk_settings %}
|
||||||
{% with request|load_helpdesk_settings as helpdesk_settings %}
|
{% with request|load_helpdesk_settings as helpdesk_settings %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% extends "helpdesk/public_base.html" %}{% load i18n humanize %}
|
{% extends "helpdesk/public_base.html" %}{% load i18n humanize %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
{% block helpdesk_title %}{% trans "View a Ticket" %}{% endblock %}
|
{% block helpdesk_title %}{% trans "View a Ticket" %}{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_body %}
|
{% block helpdesk_body %}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% extends "helpdesk/base.html" %}{% load i18n %}
|
{% extends "helpdesk/base.html" %}{% load i18n %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block helpdesk_title %}{% trans "Reports & Statistics" %}{% endblock %}
|
{% block helpdesk_title %}{% trans "Reports & Statistics" %}{% endblock %}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% extends "helpdesk/base.html" %}{% load i18n %}
|
{% extends "helpdesk/base.html" %}{% load i18n %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block helpdesk_title %}{% trans "RSS Feeds" %}{% endblock %}
|
{% block helpdesk_title %}{% trans "RSS Feeds" %}{% endblock %}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% extends "helpdesk/base.html" %}
|
{% extends "helpdesk/base.html" %}
|
||||||
{% load i18n bootstrap4form humanize %}
|
{% load i18n bootstrap4form humanize %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% load i18n humanize ticket_to_link %}
|
{% load i18n humanize ticket_to_link %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
<!--div class="card-header">
|
<!--div class="card-header">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% extends "helpdesk/base.html" %}
|
{% extends "helpdesk/base.html" %}
|
||||||
{% load i18n humanize %}
|
{% load i18n humanize %}
|
||||||
{% load static from staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block helpdesk_title %}{% trans "Tickets" %}{% endblock %}
|
{% block helpdesk_title %}{% trans "Tickets" %}{% endblock %}
|
||||||
|
|
||||||
|
@ -1218,6 +1218,9 @@ def run_report(request, report):
|
|||||||
except QueryLoadError:
|
except QueryLoadError:
|
||||||
return HttpResponseRedirect(reverse('helpdesk:report_index'))
|
return HttpResponseRedirect(reverse('helpdesk:report_index'))
|
||||||
|
|
||||||
|
if request.GET.get('saved_query', None):
|
||||||
|
Query(report_queryset, query_to_base64(query_params))
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
summarytable = defaultdict(int)
|
summarytable = defaultdict(int)
|
||||||
# a second table for more complex queries
|
# a second table for more complex queries
|
||||||
|
Loading…
Reference in New Issue
Block a user