Skip to content

Commit

Permalink
Merge pull request #883 from alligatorbait/master
Browse files Browse the repository at this point in the history
Updates required to work with Django 3.x
  • Loading branch information
gwasser committed Oct 13, 2020
2 parents c9e0a51 + df4024d commit 35cde5a
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 19 deletions.
7 changes: 3 additions & 4 deletions helpdesk/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.http import Http404
from django.shortcuts import redirect

from django.utils.decorators import available_attrs
from django.contrib.auth.decorators import user_passes_test


Expand Down Expand Up @@ -48,7 +47,7 @@ def protect_view(view_func):
Decorator for protecting the views checking user, redirecting
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):
if not request.user.is_authenticated and helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT:
return redirect('helpdesk:login')
Expand All @@ -64,7 +63,7 @@ def staff_member_required(view_func):
Decorator for staff member the views checking user, redirecting
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):
if not request.user.is_authenticated and not request.user.is_active:
return redirect('helpdesk:login')
Expand All @@ -80,7 +79,7 @@ def superuser_required(view_func):
Decorator for superuser member the views checking user, redirecting
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):
if not request.user.is_authenticated and not request.user.is_active:
return redirect('helpdesk:login')
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/base-head.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}
{% load saved_queries %}
{% load load_helpdesk_settings %}
{% load static from staticfiles %}
{% load static %}
{% with request|load_helpdesk_settings as helpdesk_settings %}
{% with user|saved_queries as user_saved_queries_ %}

Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/base.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}
{% load saved_queries %}
{% load load_helpdesk_settings %}
{% load static from staticfiles %}
{% load static %}
{% with request|load_helpdesk_settings as helpdesk_settings %}
{% with user|saved_queries as user_saved_queries_ %}
<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/base_js.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load static from staticfiles %}
{% load static %}
<!-- jQuery and Bootstrap Core -->
{% if helpdesk_settings.HELPDESK_USE_CDN %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/filters/kbitems.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n humanize %}
{% load static from staticfiles %}
{% load static %}
{% load in_list %}
<div class="form-row">
<div class="col col-sm-3">
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/filters/owner.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n humanize %}
{% load static from staticfiles %}
{% load static %}
{% load in_list %}
<div class="form-row">
<div class="col col-sm-3">
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/filters/queue.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n humanize %}
{% load static from staticfiles %}
{% load static %}
{% load in_list %}
<div class="form-row">
<div class="col col-sm-3">
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/filters/sorting.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n humanize %}
{% load static from staticfiles %}
{% load static %}
<div class="form-row">
<div class="col col-sm-3">
<label for='id_sort' class="col-form-label">{% trans "Sorting" %}:</label>
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/filters/status.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n humanize %}
{% load static from staticfiles %}
{% load static %}
{% load in_list %}
<div class="form-row">
<div class="col col-sm-3">
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/public_base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n %}
{% load static from staticfiles %}
{% load static %}
{% load load_helpdesk_settings %}
{% with request|load_helpdesk_settings as helpdesk_settings %}
<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/public_view_ticket.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "helpdesk/public_base.html" %}{% load i18n humanize %}
{% load static from staticfiles %}
{% load static %}
{% block helpdesk_title %}{% trans "View a Ticket" %}{% endblock %}

{% block helpdesk_body %}
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/report_output.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "helpdesk/base.html" %}{% load i18n %}
{% load static from staticfiles %}
{% load static %}

{% block helpdesk_title %}{% trans "Reports &amp; Statistics" %}{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/rss_list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "helpdesk/base.html" %}{% load i18n %}
{% load static from staticfiles %}
{% load static %}

{% block helpdesk_title %}{% trans "RSS Feeds" %}{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/ticket.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "helpdesk/base.html" %}
{% load i18n bootstrap4form humanize %}
{% load static from staticfiles %}
{% load static %}



Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/ticket_desc_table.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n humanize ticket_to_link %}
{% load static from staticfiles %}
{% load static %}

<div class="card mb-3">
<!--div class="card-header">
Expand Down
2 changes: 1 addition & 1 deletion helpdesk/templates/helpdesk/ticket_list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "helpdesk/base.html" %}
{% load i18n humanize %}
{% load static from staticfiles %}
{% load static %}

{% block helpdesk_title %}{% trans "Tickets" %}{% endblock %}

Expand Down
3 changes: 3 additions & 0 deletions helpdesk/views/staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,9 @@ def run_report(request, report):
except QueryLoadError:
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
summarytable = defaultdict(int)
# a second table for more complex queries
Expand Down

0 comments on commit 35cde5a

Please sign in to comment.