Merge pull request #374 from alexbarcelo/urls_app_name

Set app_name as 'helpdesk' at the urls.py, and droping url prefixes
This commit is contained in:
Jonathan Barratt 2016-10-28 15:59:29 +07:00 committed by GitHub
commit 790f1fc003
31 changed files with 187 additions and 178 deletions

View File

@ -49,10 +49,13 @@ Adding To Your Django Project
Note that you can change 'helpdesk/' to anything you like, such as 'support/' or 'help/'. If you want django-helpdesk to be available at the root of your site (for example at http://support.mysite.tld/) then the line will be as follows::
url(r'', include('helpdesk.urls')),
url(r'', include('helpdesk.urls', namespace='helpdesk')),
This line will have to come *after* any other lines in your urls.py such as those used by the Django admin.
Note that the `helpdesk` namespace is no longer required for Django 1.9 and you can use a different namespace.
However, it is recommended to use the default namespace name for clarity.
3. Create the required database tables.
Migrate using Django migrations::

View File

@ -499,7 +499,7 @@ class Ticket(models.Model):
site = Site(domain='configure-django-sites.com')
return u"http://%s%s?ticket=%s&email=%s" % (
site.domain,
reverse('helpdesk_public_view'),
reverse('helpdesk:public_view'),
self.ticket_for_url,
self.submitter_email
)
@ -518,7 +518,7 @@ class Ticket(models.Model):
site = Site(domain='configure-django-sites.com')
return u"http://%s%s" % (
site.domain,
reverse('helpdesk_view',
reverse('helpdesk:view',
args=[self.id])
)
staff_url = property(_get_staff_url)
@ -544,7 +544,7 @@ class Ticket(models.Model):
return '%s %s' % (self.id, self.title)
def get_absolute_url(self):
return 'helpdesk_view', (self.id,)
return 'helpdesk:view', (self.id,)
get_absolute_url = models.permalink(get_absolute_url)
def save(self, *args, **kwargs):
@ -939,7 +939,7 @@ class KBCategory(models.Model):
verbose_name_plural = _('Knowledge base categories')
def get_absolute_url(self):
return 'helpdesk_kb_category', (), {'slug': self.slug}
return 'kb_category', (), {'slug': self.slug}
get_absolute_url = models.permalink(get_absolute_url)
@ -1006,7 +1006,7 @@ class KBItem(models.Model):
verbose_name_plural = _('Knowledge base items')
def get_absolute_url(self):
return 'helpdesk_kb_item', (self.id,)
return 'helpdesk:kb_item', (self.id,)
get_absolute_url = models.permalink(get_absolute_url)

View File

@ -23,9 +23,9 @@
<script src="{% static 'helpdesk/bootstrap/bootstrap-3.3.7.min.js' %}" type='text/javascript'></script>
<link href="{% static 'helpdesk/bootstrap/bootstrap-3.3.7.min.css' %}" rel="stylesheet">
{% endif %}
<link rel='alternate' href='{% url 'helpdesk_rss_user' user.get_username %}' type='application/rss+xml' title='{% trans "My Open Tickets" %}' />
<link rel='alternate' href='{% url 'helpdesk_rss_activity' %}' type='application/rss+xml' title='{% trans "All Recent Activity" %}' />
<link rel='alternate' href='{% url 'helpdesk_rss_unassigned' %}' type='application/rss+xml' title='{% trans "Unassigned Tickets" %}' />
<link rel='alternate' href='{% url 'helpdesk:rss_user' user.get_username %}' type='application/rss+xml' title='{% trans "My Open Tickets" %}' />
<link rel='alternate' href='{% url 'helpdesk:rss_activity' %}' type='application/rss+xml' title='{% trans "All Recent Activity" %}' />
<link rel='alternate' href='{% url 'helpdesk:rss_unassigned' %}' type='application/rss+xml' title='{% trans "Unassigned Tickets" %}' />
<style type="text/css">
/* hide google translate top bar */
@ -65,9 +65,9 @@
<div id='footer' class="row">
<div class="col-md-2">{% include "helpdesk/attribution.html" %}</div>
<div class="col-md-2"><a href='{% url 'helpdesk_rss_index' %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "RSS Feeds" %}' border='0' />{% trans "RSS Feeds" %}</a></div>
<div class="col-md-2"><s><a href='{% url 'helpdesk_api_help' %}'>{% trans "API" %}</a></s></div>
{% if user.is_superuser %}<div class="col-md-2"><a href='{% url 'helpdesk_system_settings' %}'>{% trans "System Settings" %}</a></div>{% endif %}
<div class="col-md-2"><a href='{% url 'helpdesk:rss_index' %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "RSS Feeds" %}' border='0' />{% trans "RSS Feeds" %}</a></div>
<div class="col-md-2"><s><a href='{% url 'helpdesk:api_help' %}'>{% trans "API" %}</a></s></div>
{% if user.is_superuser %}<div class="col-md-2"><a href='{% url 'helpdesk:system_settings' %}'>{% trans "System Settings" %}</a></div>{% endif %}
</div>
</div>
{% include "helpdesk/debug.html" %}

View File

@ -20,7 +20,7 @@
<td>{{ ignore.date }}</td>
<td>{% for queue in ignore.queues.all %}{{ queue.slug }}{% if not forloop.last %}, {% endif %}{% empty %}{% trans "All" %}{% endfor %}</td>
<td>{% if ignore.keep_in_mailbox %}{% trans "Keep" %}{% endif %}</td>
<td><a href='{% url 'helpdesk_email_ignore_del' ignore.id %}'>{% trans "Delete" %}</a></td>
<td><a href='{% url 'helpdesk:email_ignore_del' ignore.id %}'>{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</tbody>

View File

@ -50,14 +50,14 @@
<li>A set of <em>data</em> to be saved into the database. This data will vary from request to request, and is outlined in <a href='#methods'>Methods</a> below.</li>
</ol>
<p>To build your request, send a HTTP POST request to <em>{% url 'helpdesk_api' "method" %}</em>, where <em>method</em> is the name of a <a href='#methods'>valid method</a> from the list below.</p>
<p>To build your request, send a HTTP POST request to <em>{% url 'helpdesk:api' "method" %}</em>, where <em>method</em> is the name of a <a href='#methods'>valid method</a> from the list below.</p>
<p>Your POST must include both <em>user</em> and <em>password</em> parameters.</p>
<p>A sample request for the method <em>hold_ticket</em> may look like this:</p>
<ul>
<li>A HTTP POST to <em>{% url 'helpdesk_api' "hold_ticket" %}</em></li>
<li>A HTTP POST to <em>{% url 'helpdesk:api' "hold_ticket" %}</em></li>
<li>A set of POST data containing:<ul>
<li>username=susan</li>
<li>password=fido</li>
@ -67,13 +67,13 @@
<p>To complete this from a command-line using the <a href='http://curl.haxx.se/'>cURL</a> application, you may use a command such as this:</p>
<pre>/usr/bin/curl {% url 'helpdesk_api' "hold_ticket" %} --data "user=susan&amp;password=fido&amp;ticket=31794"</pre>
<pre>/usr/bin/curl {% url 'helpdesk:api' "hold_ticket" %} --data "user=susan&amp;password=fido&amp;ticket=31794"</pre>
<p>In <a href='http://www.php.net/'>PHP</a>, providing you have access to the <a href='http://www.php.net/curl'>cURL libraries</a>, you may use code such as this:</p>
<pre>&lt;?php
$api = curl_init();
curl_setopt($api, CURLOPT_URL, "{% url 'helpdesk_api' "hold_ticket" %}");
curl_setopt($api, CURLOPT_URL, "{% url 'helpdesk:api' "hold_ticket" %}");
curl_setopt($api, CURLOPT_POST, 1);
curl_setopt($api, CURLOPT_POSTFIELDS, "user=susan&amp;password=fido&amp;ticket=31794");
$result = curl_exec($api);

View File

@ -4,7 +4,7 @@
<thead>
<tr><td colspan='2'>- {% trans "Average number of days until ticket is closed (all tickets): " %}<strong style="color: red;">{{ basic_ticket_stats.average_nbr_days_until_ticket_closed }}</strong>.</td></tr>
<tr><td colspan='2'>- {% trans "Average number of days until ticket is closed (tickets opened in last 60 days): " %}<strong style="color: red;">{{ basic_ticket_stats.average_nbr_days_until_ticket_closed_last_60_days }}</strong>.
{% trans "Click" %} <strong><a href="{% url 'helpdesk_report_index' %}daysuntilticketclosedbymonth">here</a></strong> {% trans "for detailed average by month." %} </td></tr>
{% trans "Click" %} <strong><a href="{% url 'helpdesk:report_index' %}daysuntilticketclosedbymonth">here</a></strong> {% trans "for detailed average by month." %} </td></tr>
<tr><td colspan='2'>- {% trans "Distribution of open tickets, grouped by time period:" %}</td></tr>
<tr><th>{% trans "Days since opened" %}</th><th>{% trans "Number of open tickets" %}</th></tr>
</thead>
@ -12,7 +12,7 @@
{% for entry in basic_ticket_stats.open_ticket_stats %}
<tr>
<th>{{ entry.0 }}</th>
<td><span style="color: {{ entry.2 }};">{% if entry.1 > 0 %}<a href="{% url 'helpdesk_list' %}?{{ entry.3 }}">{{ entry.1 }}</a>{% else %}{{ entry.1 }}{% endif %}</span></td>
<td><span style="color: {{ entry.2 }};">{% if entry.1 > 0 %}<a href="{% url 'helpdesk:list' %}?{{ entry.3 }}">{{ entry.1 }}</a>{% else %}{{ entry.1 }}{% endif %}</span></td>
</tr>
{% endfor %}
</tbody>

View File

@ -6,7 +6,7 @@
</thead>
<tbody>
{% for queue in dash_tickets %}
<tr>{% url 'helpdesk_list' as hdlist %}
<tr>{% url 'helpdesk:list' as hdlist %}
<th><a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{{ queue.name }}</a></th>
<td align="center">{% if queue.open %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{% endif %}{{ queue.open }}{% if queue.open %}</a>{% endif %}</td>
<td align="center">{% if queue.resolved %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=3'>{% endif %}{{ queue.resolved }}{% if queue.resolved %}</a>{% endif %}</td>

View File

@ -12,7 +12,7 @@
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td>
<td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|naturaltime }}</span></td>
<th><a href='{{ ticket.get_absolute_url }}?take'><span class='button button_take'>{% trans "Take" %}</span></a> | <a href='{% url 'helpdesk_delete' ticket.id %}'><span class='button button_delete'>{% trans "Delete" %}</span></a></th>
<th><a href='{{ ticket.get_absolute_url }}?take'><span class='button button_take'>{% trans "Take" %}</span></a> | <a href='{% url 'helpdesk:delete' ticket.id %}'><span class='button button_delete'>{% trans "Delete" %}</span></a></th>
</tr>
{% empty %}
<tr><td colspan='6'>{% trans "There are no unassigned tickets." %}</td></tr>

View File

@ -13,18 +13,18 @@
<div class="collapse navbar-collapse" id="helpdesk-nav-collapse">
{% if helpdesk_settings.HELPDESK_NAVIGATION_ENABLED and user.is_authenticated or user.is_staff %}
<ul class="nav navbar-nav">
<li><a href='{% url 'helpdesk_dashboard' %}'><span class="glyphicon glyphicon-dashboard"></span> <span class="nav-text">{% trans "Dashboard" %}</span></a></li>
<li><a href='{% url 'helpdesk_list' %}'><span class="glyphicon glyphicon-tags"></span> <span class="nav-text">{% trans "Tickets" %}</span></a></li>
<li><a href='{% url 'helpdesk_submit' %}'><span class="glyphicon glyphicon-plus"></span> <span class="nav-text">{% trans "New Ticket" %}</span></a></li>
<li><a href='{% url 'helpdesk_report_index' %}'><span class="glyphicon glyphicon-stats"></span> <span class="nav-text"> {% trans "Stats" %}</span></a></li>
<li><a href='{% url 'helpdesk:dashboard' %}'><span class="glyphicon glyphicon-dashboard"></span> <span class="nav-text">{% trans "Dashboard" %}</span></a></li>
<li><a href='{% url 'helpdesk:list' %}'><span class="glyphicon glyphicon-tags"></span> <span class="nav-text">{% trans "Tickets" %}</span></a></li>
<li><a href='{% url 'helpdesk:submit' %}'><span class="glyphicon glyphicon-plus"></span> <span class="nav-text">{% trans "New Ticket" %}</span></a></li>
<li><a href='{% url 'helpdesk:report_index' %}'><span class="glyphicon glyphicon-stats"></span> <span class="nav-text"> {% trans "Stats" %}</span></a></li>
{% if helpdesk_settings.HELPDESK_KB_ENABLED %}
<li><a href='{% url 'helpdesk_kb_index' %}'><span class="glyphicon glyphicon-tree-deciduous"></span> <span class="nav-text">{% trans "Knowledgebase" %}</span></a></li>
<li><a href='{% url 'helpdesk:kb_index' %}'><span class="glyphicon glyphicon-tree-deciduous"></span> <span class="nav-text">{% trans "Knowledgebase" %}</span></a></li>
{% endif %}
{% if user_saved_queries_ %}
<li class="headerlink dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-filter"></span> <span class="nav-text">{% trans "Saved Query" %} <b class="caret"></b></span></a>
<ul class="dropdown-menu">
{% for q in user_saved_queries_ %}
<li><a href="{% url 'helpdesk_list' %}?saved_query={{ q.id }}">{{ q.title }}
<li><a href="{% url 'helpdesk:list' %}?saved_query={{ q.id }}">{{ q.title }}
{% if q.shared %}
(Shared{% ifnotequal user q.user %} by {{ q.user.get_username }}{% endifnotequal %})
{% endif %}</a></li>
@ -34,18 +34,18 @@
{% endif %}
<li class="headerlink dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-user"></span> <span class="nav-text">{{ user.get_full_name|default:user.get_username }} <b class="caret"></b></span></a>
<ul class="dropdown-menu">
<li><a href='{% url 'helpdesk_user_settings' %}'>{% trans "User Settings" %}</a></li>
<li><a href='{% url 'helpdesk:user_settings' %}'>{% trans "User Settings" %}</a></li>
{% if helpdesk_settings.HELPDESK_SHOW_CHANGE_PASSWORD and user.has_usable_password %}
<li><a href='{% url 'auth_password_change' %}'>{% trans "Change password" %}</a></li>
{% endif %}
<li class="divider"></li>
<li><a href='{% url 'logout' %}'>{#<span class="glyphicon glyphicon-log-out"></span> #}{% trans "Logout" %}</a></li>
<li><a href='{% url 'helpdesk:logout' %}'>{#<span class="glyphicon glyphicon-log-out"></span> #}{% trans "Logout" %}</a></li>
</ul>
</li>
</ul>
{% if not query %}
<form class="navbar-form navbar-left" id='searchform' method='get' action="{% url 'helpdesk_list' %}">
<form class="navbar-form navbar-left" id='searchform' method='get' action="{% url 'helpdesk:list' %}">
<div class="input-group">
<input type='text' name='q' size='15' class='input form-control' placeholder='{% trans "Search..." %}' id='search_query' title='{% trans "Enter a keyword, or a ticket number to jump straight to that ticket." %}'/>
<input type='hidden' name='status' value='1' /><input type='hidden' name='status' value='2' /><input type='hidden' name='status' value='3' />
@ -61,16 +61,16 @@
{# Public menu #}
<ul id="dropdown" class="nav navbar-nav">
{% if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE %}
<li><a href='{% url 'helpdesk_dashboard' %}'>{% trans "Dashboard" %}</a></li>
<li><a href='{% url 'helpdesk_submit' %}'>{% trans "Submit a Ticket" %}</a></li>
<li><a href='{% url 'helpdesk:dashboard' %}'>{% trans "Dashboard" %}</a></li>
<li><a href='{% url 'helpdesk:submit' %}'>{% trans "Submit a Ticket" %}</a></li>
{% else %}
{% if helpdesk_settings.HELPDESK_SUBMIT_A_TICKET_PUBLIC %}
<li><a href='{% url 'helpdesk_home' %}'>{% trans "Submit a Ticket" %}</a></li>
<li><a href='{% url 'helpdesk:home' %}'>{% trans "Submit a Ticket" %}</a></li>
{% endif %}
{% endif %}
{% if helpdesk_settings.HELPDESK_KB_ENABLED %}<li><a href='{% url 'helpdesk_kb_index' %}'>{% trans "Knowledgebase" %}</a></li>{% endif %}
{% if helpdesk_settings.HELPDESK_KB_ENABLED %}<li><a href='{% url 'helpdesk:kb_index' %}'>{% trans "Knowledgebase" %}</a></li>{% endif %}
{% if not request.path == '/helpdesk/login/' or user.is_authenticated %}
<li>{% if user.is_authenticated %}<a href='{% url 'logout' %}'>{% trans "Logout" %}</a>{% else %}<a href='{% url 'login' %}?next={% if next %}{{ next|escape }}{% else %}{% url 'helpdesk_home' %}{% endif %}'>{% trans "Log In" %}</a>{% endif %}</li>
<li>{% if user.is_authenticated %}<a href='{% url 'helpdesk:logout' %}'>{% trans "Logout" %}</a>{% else %}<a href='{% url 'helpdesk:login' %}?next={% if next %}{{ next|escape }}{% else %}{% url 'helpdesk:home' %}{% endif %}'>{% trans "Log In" %}</a>{% endif %}</li>
{% endif %}
</ul>
{% endif %}

View File

@ -72,7 +72,7 @@
<div class="panel-body">
<h2>{% trans "View a Ticket" %}</h2>
<form method='get' action="{% url 'helpdesk_public_view' %}">
<form method='get' action="{% url 'helpdesk:public_view' %}">
<fieldset>
<div class="form-group {% if field.errors %}has-error{% endif %}">
<label for='id_ticket'>{% trans "Ticket" %}</label>

View File

@ -3,7 +3,7 @@
{% block helpdesk_body %}
<h2>{% trans "View a Ticket" %}</h2>
<form method='get' action='{% url 'helpdesk_public_view' %}'>
<form method='get' action='{% url 'helpdesk:public_view' %}'>
{% if error_message %}<p><strong>{% trans "Error:" %}</strong> {{ error_message }}</p>{% endif %}

View File

@ -4,7 +4,7 @@
{% block helpdesk_body %}
{% if request.user.is_authenticated %}
<meta http-equiv="REFRESH" content="0;url={% url 'helpdesk_home' %}">
<meta http-equiv="REFRESH" content="0;url={% url 'helpdesk:home' %}">
{% else %}
<div class="col-xs-6">
<div class="panel panel-default">

View File

@ -7,13 +7,13 @@
<p>{% trans "The following RSS feeds are available for you to monitor using your preferred RSS software. With the exception of the 'Latest Activity' feed, all feeds provide information only on Open and Reopened cases. This ensures your RSS reader isn't full of information about closed or historical tasks." %}</p>
<dl>
<dt><a href='{% url 'helpdesk_rss_user' user.get_username %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "My Open Tickets" %}' border='0' />{% trans "My Open Tickets" %}</a></dt>
<dt><a href='{% url 'helpdesk:rss_user' user.get_username %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "My Open Tickets" %}' border='0' />{% trans "My Open Tickets" %}</a></dt>
<dd>{% trans "A summary of your open tickets - useful for getting alerted to new tickets opened for you" %}</dd>
<dt><a href='{% url 'helpdesk_rss_activity' %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "Latest Activity" %}' border='0' />{% trans "Latest Activity" %}</a></dt>
<dt><a href='{% url 'helpdesk:rss_activity' %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "Latest Activity" %}' border='0' />{% trans "Latest Activity" %}</a></dt>
<dd>{% trans "A summary of all helpdesk activity - including comments, emails, attachments, and more" %}</dd>
<dt><a href='{% url 'helpdesk_rss_unassigned' %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "Unassigned Tickets" %}' border='0' />{% trans "Unassigned Tickets" %}</a></dt>
<dt><a href='{% url 'helpdesk:rss_unassigned' %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "Unassigned Tickets" %}' border='0' />{% trans "Unassigned Tickets" %}</a></dt>
<dd>{% trans "All unassigned tickets - useful for being alerted to new tickets opened by the public via the web or via e-mail" %}</dd>
</dl>
@ -28,8 +28,8 @@
{% for queue in queues %}
<tr>
<td>{{ queue.title }}</td>
<td align='center'><a href='{% url 'helpdesk_rss_queue' queue.slug %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "Open Tickets" %}' border='0' /></a></td>
<td align='center'><a href='{% url 'helpdesk_rss_user_queue' user.get_username queue.slug %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "My Open Tickets" %}' border='0' /></a></td>
<td align='center'><a href='{% url 'helpdesk:rss_queue' queue.slug %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "Open Tickets" %}' border='0' /></a></td>
<td align='center'><a href='{% url 'helpdesk:rss_user_queue' user.get_username queue.slug %}'><img src='{% static "helpdesk/rss_icon.png" %}' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "My Open Tickets" %}' border='0' /></a></td>
{% endfor %}
</tbody>
</table>

View File

@ -8,7 +8,7 @@
<p>{% blocktrans %}The following items can be maintained by you or other superusers:{% endblocktrans %}</p>
<ul>
<li><a href='{% url 'helpdesk_email_ignore' %}'>{% trans "E-Mail Ignore list" %}</a></li>
<li><a href='{% url 'helpdesk:email_ignore' %}'>{% trans "E-Mail Ignore list" %}</a></li>
<li><a href='{% url 'admin:helpdesk_queue_changelist' %}'>{% trans "Maintain Queues" %}</a></li>
<li><a href='{% url 'admin:helpdesk_presetreply_changelist' %}'>{% trans "Maintain Pre-Set Replies" %}</a></li>
<li><a href='{% url 'admin:helpdesk_kbcategory_changelist' %}'>{% trans "Maintain Knowledgebase Categories" %}</a></li>

View File

@ -69,11 +69,11 @@ function processAddFileClick() {
{% if not followup.public %} <span class='private'>({% trans "Private" %})</span>{% endif %}
{% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %}
{% if followup.user and request.user == followup.user and not followup.ticketchange_set.all %}
<a href="{% url 'helpdesk_followup_edit' ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Edit" alt="Edit" src="{% static "helpdesk/buttons/edit.png" %}"></a>
<a href="{% url 'helpdesk:followup_edit' ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Edit" alt="Edit" src="{% static "helpdesk/buttons/edit.png" %}"></a>
{% endif %}
{% endif %}
{% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
<a href="{% url 'helpdesk_followup_delete' ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Delete" alt="Delete" src="{% static "helpdesk/buttons/delete.png" %}"></a>
<a href="{% url 'helpdesk:followup_delete' ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Delete" alt="Delete" src="{% static "helpdesk/buttons/delete.png" %}"></a>
{% endif %}
</div>
{% else %}
@ -82,11 +82,11 @@ function processAddFileClick() {
{{ followup.title }} <span class='byline text-info'>{% if followup.user %}by {{ followup.user }}{% endif %} <span title='{{ followup.date|date:"r" }}'>{{ followup.date|naturaltime }}</span>{% if not followup.public %} <span class='private'>({% trans "Private" %})</span>{% endif %}</span>
{% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %}
{% if followup.user and request.user == followup.user and not followup.ticketchange_set.all %}
<a href="{% url 'helpdesk_followup_edit' ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Edit" alt="Edit" src="{% static "helpdesk/buttons/edit.png" %}"></a>
<a href="{% url 'helpdesk:followup_edit' ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Edit" alt="Edit" src="{% static "helpdesk/buttons/edit.png" %}"></a>
{% endif %}
{% endif %}
{% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
<a href="{% url 'helpdesk_followup_delete' ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Delete" alt="Delete" src="{% static "helpdesk/buttons/delete.png" %}"></a>
<a href="{% url 'helpdesk:followup_delete' ticket.id followup.id %}" class='followup-edit'><img width="60" height="15" title="Delete" alt="Delete" src="{% static "helpdesk/buttons/delete.png" %}"></a>
{% endif %}
</div>
{% endif %}
@ -99,7 +99,7 @@ function processAddFileClick() {
{% for attachment in followup.attachment_set.all %}{% if forloop.first %}<div class='attachments'><ul>{% endif %}
<li><a href='{{ attachment.file.url }}'>{{ attachment.filename }}</a> ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})
{% if followup.user and request.user == followup.user %}
<a href='{% url 'helpdesk_attachment_del' ticket.id attachment.id %}'>delete</a>
<a href='{% url 'helpdesk:attachment_del' ticket.id attachment.id %}'>delete</a>
{% endif %}
</li>
{% if forloop.last %}</ul></div>{% endif %}

View File

@ -20,12 +20,12 @@
<td>{{ person.display }}</td>
<td>{{ person.can_view }}</td>
<td>{{ person.can_update }}</td>
<td><a href='{% url 'helpdesk_ticket_cc_del' ticket.id person.id %}'>{% trans "Delete" %}</a></td>
<td><a href='{% url 'helpdesk:ticket_cc_del' ticket.id person.id %}'>{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
<p><a href='{% url 'helpdesk_view' ticket.id %}'>{% blocktrans with ticket.title as ticket_title %}Return to <em>{{ ticket_title }}</em>{% endblocktrans %}</a></p>
<p><a href='{% url 'helpdesk:view' ticket.id %}'>{% blocktrans with ticket.title as ticket_title %}Return to <em>{{ ticket_title }}</em>{% endblocktrans %}</a></p>
{% endblock %}

View File

@ -3,9 +3,9 @@
<table class="table table-hover table-bordered table-striped">
<thead>
<tr class='row_tablehead'><td colspan='2'><h3>{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status }}]</h3> <span class='ticket_toolbar'>
<a href='{% url 'helpdesk_edit' ticket.id %}' class="ticket-edit"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
| <a href='{% url 'helpdesk_delete' ticket.id %}' class="ticket-delete"><span class="glyphicon glyphicon-remove"></span> Delete</a>
{% if ticket.on_hold %} | <a href='{% url 'helpdesk_unhold' ticket.id %}' class="ticket-hold">{% trans "Unhold" %}</a>{% else %} | <a href='{% url 'helpdesk_hold' ticket.id %}' class="ticket-hold">{% trans "Hold" %}</a>{% endif %}
<a href='{% url 'helpdesk:edit' ticket.id %}' class="ticket-edit"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
| <a href='{% url 'helpdesk:delete' ticket.id %}' class="ticket-delete"><span class="glyphicon glyphicon-remove"></span> Delete</a>
{% if ticket.on_hold %} | <a href='{% url 'helpdesk:unhold' ticket.id %}' class="ticket-hold">{% trans "Unhold" %}</a>{% else %} | <a href='{% url 'helpdesk:hold' ticket.id %}' class="ticket-hold">{% trans "Hold" %}</a>{% endif %}
</span></td></tr>
<tr><th colspan='2'>{% blocktrans with ticket.queue as queue %}Queue: {{ queue }}{% endblocktrans %}</th></tr>
</thead>
@ -41,7 +41,7 @@
<tr>
<th>{% trans "Submitter E-Mail" %}</th>
<td>{{ ticket.submitter_email }}{% if user.is_superuser %} <strong><a href='{% url 'helpdesk_email_ignore_add' %}?email={{ ticket.submitter_email }}'>{% trans "Ignore" %}</a></strong>{% endif %}</td>
<td>{{ ticket.submitter_email }}{% if user.is_superuser %} <strong><a href='{% url 'helpdesk:email_ignore_add' %}?email={{ ticket.submitter_email }}'>{% trans "Ignore" %}</a></strong>{% endif %}</td>
</tr>
<tr>
@ -51,19 +51,19 @@
<tr>
<th>{% trans "Copies To" %}</th>
<td>{{ ticketcc_string }} <a data-toggle='tooltip' href='{% url 'helpdesk_ticket_cc' ticket.id %}' title='{% trans "Click here to add / remove people who should receive an e-mail whenever this ticket is updated." %}'><strong>{% trans "Manage" %}</strong></a>{% if SHOW_SUBSCRIBE %}, <strong><a data-toggle='tooltip' href='?subscribe' title='{% trans "Click here to subscribe yourself to this ticket, if you want to receive an e-mail whenever this ticket is updated." %}'>{% trans "Subscribe" %}</a></strong>{% endif %}</td>
<td>{{ ticketcc_string }} <a data-toggle='tooltip' href='{% url 'helpdesk:ticket_cc' ticket.id %}' title='{% trans "Click here to add / remove people who should receive an e-mail whenever this ticket is updated." %}'><strong>{% trans "Manage" %}</strong></a>{% if SHOW_SUBSCRIBE %}, <strong><a data-toggle='tooltip' href='?subscribe' title='{% trans "Click here to subscribe yourself to this ticket, if you want to receive an e-mail whenever this ticket is updated." %}'>{% trans "Subscribe" %}</a></strong>{% endif %}</td>
</tr>
<tr>
<th>{% trans "Dependencies" %}</th>
<td>{% for dep in ticket.ticketdependency.all %}
{% if forloop.first %}<p>{% trans "This ticket cannot be resolved until the following ticket(s) are resolved" %}</p><ul>{% endif %}
<li><a href='{{ dep.depends_on.get_absolute_url }}'>{{ dep.depends_on.ticket }} {{ dep.depends_on.title }}</a> ({{ dep.depends_on.get_status_display }}) <a href='{% url 'helpdesk_ticket_dependency_del' ticket.id dep.id %}'>{% trans "Remove Dependency" %}</a></li>
<li><a href='{{ dep.depends_on.get_absolute_url }}'>{{ dep.depends_on.ticket }} {{ dep.depends_on.title }}</a> ({{ dep.depends_on.get_status_display }}) <a href='{% url 'helpdesk:ticket_dependency_del' ticket.id dep.id %}'>{% trans "Remove Dependency" %}</a></li>
{% if forloop.last %}</ul>{% endif %}
{% empty %}
<p>{% trans "This ticket has no dependencies." %}</p>
{% endfor %}
<p><a data-toggle='tooltip' href='{% url 'helpdesk_ticket_dependency_add' ticket.id %}' title="{% trans "Click on 'Add Dependency', if you want to make this ticket dependent on another ticket. A ticket may not be closed until all tickets it depends on are closed." %}">{% trans "Add Dependency" %}</a></p>
<p><a data-toggle='tooltip' href='{% url 'helpdesk:ticket_dependency_add' ticket.id %}' title="{% trans "Click on 'Add Dependency', if you want to make this ticket dependent on another ticket. A ticket may not be closed until all tickets it depends on are closed." %}">{% trans "Add Dependency" %}</a></p>
</td>
</tr>

View File

@ -141,7 +141,7 @@ $(document).ready(function() {
<hr style='clear: both;' />
<input class="btn btn-primary" type='submit' value='{% trans "Apply Filter" %}' />
{% if from_saved_query and saved_query.user == user %}
<p>{% blocktrans with saved_query.title as query_name %}You are currently viewing saved query <strong>"{{ query_name }}"</strong>.{% endblocktrans %} <a href='{% url 'helpdesk_delete_query' saved_query.id %}'>{% trans "Delete Saved Query" %}</a></p>
<p>{% blocktrans with saved_query.title as query_name %}You are currently viewing saved query <strong>"{{ query_name }}"</strong>.{% endblocktrans %} <a href='{% url 'helpdesk:delete_query' saved_query.id %}'>{% trans "Delete Saved Query" %}</a></p>
{% endif %}
{% if from_saved_query %}
<p>{% blocktrans with saved_query.id as query_id %}<a href='../reports/?saved_query={{ query_id }}'>Run a report</a> on this query to see stats and charts for the data listed below.{% endblocktrans %}</p>
@ -162,7 +162,7 @@ $(document).ready(function() {
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
<form method='post' action='{% url 'helpdesk_savequery' %}'>
<form method='post' action='{% url 'helpdesk:savequery' %}'>
<input type='hidden' name='query_encoded' value='{{ urlsafe_query }}' />
<dl>
<dt><label for='id_title'>{% trans "Query Name" %}</label></dt>
@ -196,7 +196,7 @@ $(document).ready(function() {
</div>
<div id="collapseThree" class="panel-collapse collapse">
<div class="panel-body">
<form method='get' action='{% url 'helpdesk_list' %}'>
<form method='get' action='{% url 'helpdesk:list' %}'>
<p><label for='id_query_selector'>{% trans "Query" %}</label> <select name='saved_query' id='id_query_selector'>
{% for q in user_saved_queries %}
<option value='{{ q.id }}'>{{ q.title }}{% if q.shared %} (Shared{% ifnotequal user q.user %} by {{ q.user.get_username }}{% endifnotequal %}){% endif %}</option>
@ -216,7 +216,7 @@ $(document).ready(function() {
<div class="row">
{{ search_message|safe }}
<form method='post' action='{% url 'helpdesk_mass_update' %}' id="ticket_mass_update">
<form method='post' action='{% url 'helpdesk:mass_update' %}' id="ticket_mass_update">
<table class="table table-hover table-bordered table-striped">
<caption>{% trans "Tickets" %}</caption>
<thead>

View File

@ -30,7 +30,7 @@ def num_to_link(text):
for match in reversed(matches):
number = match.groups()[0]
url = reverse('helpdesk_view', args=[number])
url = reverse('helpdesk:view', args=[number])
try:
ticket = Ticket.objects.get(id=number)
except Ticket.DoesNotExist:

View File

@ -26,11 +26,11 @@ class TestKBDisabled(TestCase):
from django.core.urlresolvers import NoReverseMatch
self.client.login(username=get_staff_user().get_username(), password='password')
self.assertRaises(NoReverseMatch, reverse, 'helpdesk_kb_index')
self.assertRaises(NoReverseMatch, reverse, 'helpdesk:kb_index')
try:
response = self.client.get(reverse('helpdesk_dashboard'))
response = self.client.get(reverse('helpdesk:dashboard'))
except NoReverseMatch as e:
if 'helpdesk_kb_index' in e.message:
if 'helpdesk:kb_index' in e.message:
self.fail("Please verify any unchecked references to helpdesk_kb_index (start with navigation.html)")
else:
raise

View File

@ -75,7 +75,7 @@ class PerQueueStaffMembershipTestCase(TestCase):
# Regular users
for identifier in self.IDENTIFIERS:
self.client.login(username='User_%d' % identifier, password=str(identifier))
response = self.client.get(reverse('helpdesk_dashboard'))
response = self.client.get(reverse('helpdesk:dashboard'))
self.assertEqual(
len(response.context['unassigned_tickets']),
identifier,
@ -99,7 +99,7 @@ class PerQueueStaffMembershipTestCase(TestCase):
# Superuser
self.client.login(username='superuser', password='superuser')
response = self.client.get(reverse('helpdesk_dashboard'))
response = self.client.get(reverse('helpdesk:dashboard'))
self.assertEqual(
len(response.context['unassigned_tickets']),
3,
@ -132,7 +132,7 @@ class PerQueueStaffMembershipTestCase(TestCase):
# Regular users
for identifier in self.IDENTIFIERS:
self.client.login(username='User_%d' % identifier, password=str(identifier))
response = self.client.get(reverse('helpdesk_list'))
response = self.client.get(reverse('helpdesk:list'))
self.assertEqual(
len(response.context['tickets']),
identifier * 2,
@ -151,7 +151,7 @@ class PerQueueStaffMembershipTestCase(TestCase):
# Superuser
self.client.login(username='superuser', password='superuser')
response = self.client.get(reverse('helpdesk_list'))
response = self.client.get(reverse('helpdesk:list'))
self.assertEqual(
len(response.context['tickets']),
6,
@ -168,7 +168,7 @@ class PerQueueStaffMembershipTestCase(TestCase):
for identifier in self.IDENTIFIERS:
self.client.login(username='User_%d' % identifier, password=str(identifier))
response = self.client.get(
reverse('helpdesk_run_report', kwargs={'report': 'userqueue'})
reverse('helpdesk:run_report', kwargs={'report': 'userqueue'})
)
# Only two columns of data should be present: ticket counts for
# unassigned and this user only
@ -199,7 +199,7 @@ class PerQueueStaffMembershipTestCase(TestCase):
# Superuser
self.client.login(username='superuser', password='superuser')
response = self.client.get(
reverse('helpdesk_run_report', kwargs={'report': 'userqueue'})
reverse('helpdesk:run_report', kwargs={'report': 'userqueue'})
)
# Superuser should see ticket counts for all two queues, which includes
# three columns: unassigned and both user 1 and user 2

View File

@ -30,7 +30,7 @@ class PublicActionsTestCase(TestCase):
def test_public_view_ticket(self):
response = self.client.get('%s?ticket=%s&email=%s' % (
reverse('helpdesk_public_view'),
reverse('helpdesk:public_view'),
self.ticket.ticket_for_url,
'test.submitter@example.com'))
self.assertEqual(response.status_code, 200)
@ -50,7 +50,7 @@ class PublicActionsTestCase(TestCase):
current_followups = ticket.followup_set.all().count()
response = self.client.get('%s?ticket=%s&email=%s&close' % (
reverse('helpdesk_public_view'),
reverse('helpdesk:public_view'),
ticket.ticket_for_url,
'test.submitter@example.com'))

View File

@ -13,7 +13,7 @@ class TestSavingSharedQuery(TestCase):
def test_cansavequery(self):
"""Can a query be saved"""
url = reverse('helpdesk_savequery')
url = reverse('helpdesk:savequery')
self.client.login(username=get_staff_user().get_username(),
password='password')
response = self.client.post(

View File

@ -25,7 +25,7 @@ class TestKBDisabled(TestCase):
# we will exercise 'reverse' to lookup/build the URL
# from the ticket info we have
# http://example.com/helpdesk/view/?ticket=q1-1&email=None
response = self.client.get(reverse('helpdesk_public_view'),
response = self.client.get(reverse('helpdesk:public_view'),
{'ticket': self.ticket.ticket_for_url,
'email': self.ticket.submitter_email})
self.assertEqual(response.status_code, 200)
@ -36,7 +36,7 @@ class TestKBDisabled(TestCase):
q2 = Queue(title='Q2', slug='q2')
q2.save()
# grab the URL / params which would have been emailed out to submitter.
url = reverse('helpdesk_public_view')
url = reverse('helpdesk:public_view')
params = {'ticket': self.ticket.ticket_for_url,
'email': self.ticket.submitter_email}
# Pickup the ticket created in setup() and change its queue

View File

@ -44,7 +44,7 @@ class TicketBasicsTestCase(TestCase):
def test_create_ticket_public(self):
email_count = len(mail.outbox)
response = self.client.get(reverse('helpdesk_home'))
response = self.client.get(reverse('helpdesk:home'))
self.assertEqual(response.status_code, 200)
post_data = {
@ -55,7 +55,7 @@ class TicketBasicsTestCase(TestCase):
'priority': 3,
}
response = self.client.post(reverse('helpdesk_home'), post_data, follow=True)
response = self.client.post(reverse('helpdesk:home'), post_data, follow=True)
last_redirect = response.redirect_chain[-1]
last_redirect_url = last_redirect[0]
# last_redirect_status = last_redirect[1]
@ -64,7 +64,7 @@ class TicketBasicsTestCase(TestCase):
# Django 1.9 compatible way of testing this
# https://docs.djangoproject.com/en/1.9/releases/1.9/#http-redirects-no-longer-forced-to-absolute-uris
urlparts = urlparse(last_redirect_url)
self.assertEqual(urlparts.path, reverse('helpdesk_public_view'))
self.assertEqual(urlparts.path, reverse('helpdesk:public_view'))
# Ensure submitter, new-queue + update-queue were all emailed.
self.assertEqual(email_count + 3, len(mail.outbox))
@ -79,7 +79,7 @@ class TicketBasicsTestCase(TestCase):
'priority': 3,
}
response = self.client.post(reverse('helpdesk_home'), post_data)
response = self.client.post(reverse('helpdesk:home'), post_data)
self.assertEqual(response.status_code, 200)
self.assertEqual(email_count, len(mail.outbox))
self.assertContains(response, 'Select a valid choice.')
@ -108,7 +108,7 @@ class TicketBasicsTestCase(TestCase):
'custom_textfield': 'This is my custom text.',
}
response = self.client.post(reverse('helpdesk_home'), post_data, follow=True)
response = self.client.post(reverse('helpdesk:home'), post_data, follow=True)
custom_field_1.delete()
last_redirect = response.redirect_chain[-1]
@ -119,7 +119,7 @@ class TicketBasicsTestCase(TestCase):
# Django 1.9 compatible way of testing this
# https://docs.djangoproject.com/en/1.9/releases/1.9/#http-redirects-no-longer-forced-to-absolute-uris
urlparts = urlparse(last_redirect_url)
self.assertEqual(urlparts.path, reverse('helpdesk_public_view'))
self.assertEqual(urlparts.path, reverse('helpdesk:public_view'))
# Ensure only two e-mails were sent - submitter & updated.
self.assertEqual(email_count + 2, len(mail.outbox))

5
helpdesk/tests/urls.py Normal file
View File

@ -0,0 +1,5 @@
from django.conf.urls import include, url
urlpatterns = [
url(r'^helpdesk/', include('helpdesk.urls', namespace='helpdesk')),
]

View File

@ -29,161 +29,163 @@ class DirectTemplateView(TemplateView):
context[key] = value
return context
app_name = 'helpdesk'
urlpatterns = [
url(r'^dashboard/$',
staff.dashboard,
name='helpdesk_dashboard'),
name='dashboard'),
url(r'^tickets/$',
staff.ticket_list,
name='helpdesk_list'),
name='list'),
url(r'^tickets/update/$',
staff.mass_update,
name='helpdesk_mass_update'),
name='mass_update'),
url(r'^tickets/submit/$',
staff.create_ticket,
name='helpdesk_submit'),
name='submit'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/$',
staff.view_ticket,
name='helpdesk_view'),
name='view'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/followup_edit/(?P<followup_id>[0-9]+)/$',
staff.followup_edit,
name='helpdesk_followup_edit'),
name='followup_edit'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/followup_delete/(?P<followup_id>[0-9]+)/$',
staff.followup_delete,
name='helpdesk_followup_delete'),
name='followup_delete'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/edit/$',
staff.edit_ticket,
name='helpdesk_edit'),
name='edit'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/update/$',
staff.update_ticket,
name='helpdesk_update'),
name='update'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/delete/$',
staff.delete_ticket,
name='helpdesk_delete'),
name='delete'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/hold/$',
staff.hold_ticket,
name='helpdesk_hold'),
name='hold'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/unhold/$',
staff.unhold_ticket,
name='helpdesk_unhold'),
name='unhold'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/cc/$',
staff.ticket_cc,
name='helpdesk_ticket_cc'),
name='ticket_cc'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/cc/add/$',
staff.ticket_cc_add,
name='helpdesk_ticket_cc_add'),
name='ticket_cc_add'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/cc/delete/(?P<cc_id>[0-9]+)/$',
staff.ticket_cc_del,
name='helpdesk_ticket_cc_del'),
name='ticket_cc_del'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/dependency/add/$',
staff.ticket_dependency_add,
name='helpdesk_ticket_dependency_add'),
name='ticket_dependency_add'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/dependency/delete/(?P<dependency_id>[0-9]+)/$',
staff.ticket_dependency_del,
name='helpdesk_ticket_dependency_del'),
name='ticket_dependency_del'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/attachment_delete/(?P<attachment_id>[0-9]+)/$',
staff.attachment_del,
name='helpdesk_attachment_del'),
name='attachment_del'),
url(r'^raw/(?P<type>\w+)/$',
staff.raw_details,
name='helpdesk_raw'),
name='raw'),
url(r'^rss/$',
staff.rss_list,
name='helpdesk_rss_index'),
name='rss_index'),
url(r'^reports/$',
staff.report_index,
name='helpdesk_report_index'),
name='report_index'),
url(r'^reports/(?P<report>\w+)/$',
staff.run_report,
name='helpdesk_run_report'),
name='run_report'),
url(r'^save_query/$',
staff.save_query,
name='helpdesk_savequery'),
name='savequery'),
url(r'^delete_query/(?P<id>[0-9]+)/$',
staff.delete_saved_query,
name='helpdesk_delete_query'),
name='delete_query'),
url(r'^settings/$',
staff.user_settings,
name='helpdesk_user_settings'),
name='user_settings'),
url(r'^ignore/$',
staff.email_ignore,
name='helpdesk_email_ignore'),
name='email_ignore'),
url(r'^ignore/add/$',
staff.email_ignore_add,
name='helpdesk_email_ignore_add'),
name='email_ignore_add'),
url(r'^ignore/delete/(?P<id>[0-9]+)/$',
staff.email_ignore_del,
name='helpdesk_email_ignore_del'),
name='email_ignore_del'),
]
urlpatterns += [
url(r'^$',
public.homepage,
name='helpdesk_home'),
name='home'),
url(r'^view/$',
public.view_ticket,
name='helpdesk_public_view'),
name='public_view'),
url(r'^change_language/$',
public.change_language,
name='helpdesk_public_change_language'),
name='public_change_language'),
]
urlpatterns += [
url(r'^rss/user/(?P<user_name>[^/]+)/$',
login_required(feeds.OpenTicketsByUser()),
name='helpdesk_rss_user'),
name='rss_user'),
url(r'^rss/user/(?P<user_name>[^/]+)/(?P<queue_slug>[A-Za-z0-9_-]+)/$',
login_required(feeds.OpenTicketsByUser()),
name='helpdesk_rss_user_queue'),
name='rss_user_queue'),
url(r'^rss/queue/(?P<queue_slug>[A-Za-z0-9_-]+)/$',
login_required(feeds.OpenTicketsByQueue()),
name='helpdesk_rss_queue'),
name='rss_queue'),
url(r'^rss/unassigned/$',
login_required(feeds.UnassignedTickets()),
name='helpdesk_rss_unassigned'),
name='rss_unassigned'),
url(r'^rss/recent_activity/$',
login_required(feeds.RecentFollowUps()),
name='helpdesk_rss_activity'),
name='rss_activity'),
]
urlpatterns += [
url(r'^api/(?P<method>[a-z_-]+)/$',
api.api,
name='helpdesk_api'),
name='api'),
url(r'^login/$',
auth_views.login,
@ -200,31 +202,31 @@ if helpdesk_settings.HELPDESK_KB_ENABLED:
urlpatterns += [
url(r'^kb/$',
kb.index,
name='helpdesk_kb_index'),
name='kb_index'),
url(r'^kb/(?P<item>[0-9]+)/$',
kb.item,
name='helpdesk_kb_item'),
name='kb_item'),
url(r'^kb/(?P<item>[0-9]+)/vote/$',
kb.vote,
name='helpdesk_kb_vote'),
name='kb_vote'),
url(r'^kb/(?P<slug>[A-Za-z0-9_-]+)/$',
kb.category,
name='helpdesk_kb_category'),
name='kb_category'),
]
urlpatterns += [
url(r'^api/$',
TemplateView.as_view(template_name='helpdesk/help_api.html'),
name='helpdesk_api_help'),
name='api_help'),
url(r'^help/context/$',
TemplateView.as_view(template_name='helpdesk/help_context.html'),
name='helpdesk_help_context'),
name='help_context'),
url(r'^system_settings/$',
DirectTemplateView.as_view(template_name='helpdesk/system_settings.html'),
name='helpdesk_system_settings'),
name='system_settings'),
]

View File

@ -57,13 +57,13 @@ class OpenTicketsByUser(Feed):
def link(self, obj):
if obj['queue']:
return u'%s?assigned_to=%s&queue=%s' % (
reverse('helpdesk_list'),
reverse('helpdesk:list'),
obj['user'].id,
obj['queue'].id,
)
else:
return u'%s?assigned_to=%s' % (
reverse('helpdesk_list'),
reverse('helpdesk:list'),
obj['user'].id,
)
@ -99,7 +99,7 @@ class UnassignedTickets(Feed):
title = _('Helpdesk: Unassigned Tickets')
description = _('Unassigned Open and Reopened tickets')
link = '' # '%s?assigned_to=' % reverse('helpdesk_list')
link = '' # '%s?assigned_to=' % reverse('helpdesk:list')
def items(self, obj):
return Ticket.objects.filter(
@ -124,7 +124,7 @@ class RecentFollowUps(Feed):
title = _('Helpdesk: Recent Followups')
description = _('Recent FollowUps, such as e-mail replies, comments, attachments and resolutions')
link = '/tickets/' # reverse('helpdesk_list')
link = '/tickets/' # reverse('helpdesk:list')
def items(self):
return FollowUp.objects.order_by('-date')[:20]
@ -149,7 +149,7 @@ class OpenTicketsByQueue(Feed):
def link(self, obj):
return '%s?queue=%s' % (
reverse('helpdesk_list'),
reverse('helpdesk:list'),
obj.id,
)

View File

@ -20,18 +20,18 @@ from helpdesk.models import Ticket, Queue, UserSettings, KBCategory
def homepage(request):
if not request.user.is_authenticated() and helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT:
return HttpResponseRedirect(reverse('login'))
return HttpResponseRedirect(reverse('helpdesk:login'))
if request.user.is_staff or \
(request.user.is_authenticated() and
helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE):
try:
if request.user.usersettings.settings.get('login_view_ticketlist', False):
return HttpResponseRedirect(reverse('helpdesk_list'))
return HttpResponseRedirect(reverse('helpdesk:list'))
else:
return HttpResponseRedirect(reverse('helpdesk_dashboard'))
return HttpResponseRedirect(reverse('helpdesk:dashboard'))
except UserSettings.DoesNotExist:
return HttpResponseRedirect(reverse('helpdesk_dashboard'))
return HttpResponseRedirect(reverse('helpdesk:dashboard'))
if request.method == 'POST':
form = PublicTicketForm(request.POST, request.FILES)
@ -44,7 +44,7 @@ def homepage(request):
else:
ticket = form.save()
return HttpResponseRedirect('%s?ticket=%s&email=%s' % (
reverse('helpdesk_public_view'),
reverse('helpdesk:public_view'),
ticket.ticket_for_url,
ticket.submitter_email)
)
@ -92,7 +92,7 @@ def view_ticket(request):
})
else:
if request.user.is_staff:
redirect_url = reverse('helpdesk_view', args=[ticket_id])
redirect_url = reverse('helpdesk:view', args=[ticket_id])
if 'close' in request.GET:
redirect_url += '?close'
return HttpResponseRedirect(redirect_url)
@ -116,7 +116,7 @@ def view_ticket(request):
# redirect user back to this ticket if possible.
redirect_url = ''
if helpdesk_settings.HELPDESK_NAVIGATION_ENABLED:
redirect_url = reverse('helpdesk_view', args=[ticket_id])
redirect_url = reverse('helpdesk:view', args=[ticket_id])
return render(request, 'helpdesk/public_view_ticket.html', {
'ticket': ticket,

View File

@ -183,7 +183,7 @@ def delete_ticket(request, ticket_id):
})
else:
ticket.delete()
return HttpResponseRedirect(reverse('helpdesk_home'))
return HttpResponseRedirect(reverse('helpdesk:home'))
delete_ticket = staff_member_required(delete_ticket)
@ -233,7 +233,7 @@ def followup_edit(request, ticket_id, followup_id):
attachment.save()
# delete old followup
followup.delete()
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
return HttpResponseRedirect(reverse('helpdesk:view', args=[ticket.id]))
followup_edit = staff_member_required(followup_edit)
@ -242,11 +242,11 @@ def followup_delete(request, ticket_id, followup_id):
ticket = get_object_or_404(Ticket, id=ticket_id)
if not request.user.is_superuser:
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
return HttpResponseRedirect(reverse('helpdesk:view', args=[ticket.id]))
followup = get_object_or_404(FollowUp, id=followup_id)
followup.delete()
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
return HttpResponseRedirect(reverse('helpdesk:view', args=[ticket.id]))
followup_delete = staff_member_required(followup_delete)
@ -274,7 +274,7 @@ def view_ticket(request, ticket_id):
return_ticketccstring_and_show_subscribe(request.user, ticket)
if show_subscribe:
subscribe_staff_member_to_ticket(ticket, request.user)
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
return HttpResponseRedirect(reverse('helpdesk:view', args=[ticket.id]))
if 'close' in request.GET and ticket.status == Ticket.RESOLVED_STATUS:
if not ticket.assigned_to:
@ -370,7 +370,7 @@ def update_ticket(request, ticket_id, public=False):
request.user.is_staff or
helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE))):
return HttpResponseRedirect('%s?next=%s' %
(reverse('login'), request.path))
(reverse('helpdesk:login'), request.path))
ticket = get_object_or_404(Ticket, id=ticket_id)
@ -647,7 +647,7 @@ def mass_update(request):
tickets = request.POST.getlist('ticket_id')
action = request.POST.get('action', None)
if not (tickets and action):
return HttpResponseRedirect(reverse('helpdesk_list'))
return HttpResponseRedirect(reverse('helpdesk:list'))
if action.startswith('assign_'):
parts = action.split('_')
@ -755,7 +755,7 @@ def mass_update(request):
elif action == 'delete':
t.delete()
return HttpResponseRedirect(reverse('helpdesk_list'))
return HttpResponseRedirect(reverse('helpdesk:list'))
mass_update = staff_member_required(mass_update)
@ -818,9 +818,9 @@ def ticket_list(request):
try:
saved_query = SavedSearch.objects.get(pk=request.GET.get('saved_query'))
except SavedSearch.DoesNotExist:
return HttpResponseRedirect(reverse('helpdesk_list'))
return HttpResponseRedirect(reverse('helpdesk:list'))
if not (saved_query.shared or saved_query.user == request.user):
return HttpResponseRedirect(reverse('helpdesk_list'))
return HttpResponseRedirect(reverse('helpdesk:list'))
import json
from helpdesk.lib import b64decode
@ -828,7 +828,7 @@ def ticket_list(request):
query_params = json.loads(b64decode(str(saved_query.query)))
except ValueError:
# Query deserialization failed. (E.g. was a pickled query)
return HttpResponseRedirect(reverse('helpdesk_list'))
return HttpResponseRedirect(reverse('helpdesk:list'))
elif not ('queue' in request.GET or
'assigned_to' in request.GET or
@ -989,7 +989,7 @@ def create_ticket(request):
if _has_access_to_queue(request.user, ticket.queue):
return HttpResponseRedirect(ticket.get_absolute_url())
else:
return HttpResponseRedirect(reverse('helpdesk_dashboard'))
return HttpResponseRedirect(reverse('helpdesk:dashboard'))
else:
initial_data = {}
if request.user.usersettings.settings.get('use_email_as_submitter', False) and request.user.email:
@ -1093,16 +1093,16 @@ def run_report(request, report):
try:
saved_query = SavedSearch.objects.get(pk=request.GET.get('saved_query'))
except SavedSearch.DoesNotExist:
return HttpResponseRedirect(reverse('helpdesk_report_index'))
return HttpResponseRedirect(reverse('helpdesk:report_index'))
if not (saved_query.shared or saved_query.user == request.user):
return HttpResponseRedirect(reverse('helpdesk_report_index'))
return HttpResponseRedirect(reverse('helpdesk:report_index'))
import json
from helpdesk.lib import b64decode
try:
query_params = json.loads(b64decode(str(saved_query.query)))
except:
return HttpResponseRedirect(reverse('helpdesk_report_index'))
return HttpResponseRedirect(reverse('helpdesk:report_index'))
report_queryset = apply_query(report_queryset, query_params)
@ -1263,12 +1263,12 @@ def save_query(request):
query_encoded = request.POST.get('query_encoded', None)
if not title or not query_encoded:
return HttpResponseRedirect(reverse('helpdesk_list'))
return HttpResponseRedirect(reverse('helpdesk:list'))
query = SavedSearch(title=title, shared=shared, query=query_encoded, user=request.user)
query.save()
return HttpResponseRedirect('%s?saved_query=%s' % (reverse('helpdesk_list'), query.id))
return HttpResponseRedirect('%s?saved_query=%s' % (reverse('helpdesk:list'), query.id))
save_query = staff_member_required(save_query)
@ -1277,7 +1277,7 @@ def delete_saved_query(request, id):
if request.method == 'POST':
query.delete()
return HttpResponseRedirect(reverse('helpdesk_list'))
return HttpResponseRedirect(reverse('helpdesk:list'))
else:
return render(request, 'helpdesk/confirm_delete_saved_query.html', {'query': query})
delete_saved_query = staff_member_required(delete_saved_query)
@ -1309,7 +1309,7 @@ def email_ignore_add(request):
form = EmailIgnoreForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(reverse('helpdesk_email_ignore'))
return HttpResponseRedirect(reverse('helpdesk:email_ignore'))
else:
form = EmailIgnoreForm(request.GET)
@ -1321,7 +1321,7 @@ def email_ignore_del(request, id):
ignore = get_object_or_404(IgnoreEmail, id=id)
if request.method == 'POST':
ignore.delete()
return HttpResponseRedirect(reverse('helpdesk_email_ignore'))
return HttpResponseRedirect(reverse('helpdesk:email_ignore'))
else:
return render(request, 'helpdesk/email_ignore_del.html', {'ignore': ignore})
email_ignore_del = superuser_required(email_ignore_del)
@ -1351,7 +1351,7 @@ def ticket_cc_add(request, ticket_id):
ticketcc = form.save(commit=False)
ticketcc.ticket = ticket
ticketcc.save()
return HttpResponseRedirect(reverse('helpdesk_ticket_cc',
return HttpResponseRedirect(reverse('helpdesk:ticket_cc',
kwargs={'ticket_id': ticket.id}))
else:
form = TicketCCForm()
@ -1367,7 +1367,7 @@ def ticket_cc_del(request, ticket_id, cc_id):
if request.method == 'POST':
cc.delete()
return HttpResponseRedirect(reverse('helpdesk_ticket_cc',
return HttpResponseRedirect(reverse('helpdesk:ticket_cc',
kwargs={'ticket_id': cc.ticket.id}))
return render(request, 'helpdesk/ticket_cc_del.html', {'cc': cc})
ticket_cc_del = staff_member_required(ticket_cc_del)
@ -1384,7 +1384,7 @@ def ticket_dependency_add(request, ticket_id):
ticketdependency.ticket = ticket
if ticketdependency.ticket != ticketdependency.depends_on:
ticketdependency.save()
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id]))
return HttpResponseRedirect(reverse('helpdesk:view', args=[ticket.id]))
else:
form = TicketDependencyForm()
return render(request, 'helpdesk/ticket_dependency_add.html', {
@ -1398,7 +1398,7 @@ def ticket_dependency_del(request, ticket_id, dependency_id):
dependency = get_object_or_404(TicketDependency, ticket__id=ticket_id, id=dependency_id)
if request.method == 'POST':
dependency.delete()
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket_id]))
return HttpResponseRedirect(reverse('helpdesk:view', args=[ticket_id]))
return render(request, 'helpdesk/ticket_dependency_del.html', {'dependency': dependency})
ticket_dependency_del = staff_member_required(ticket_dependency_del)
@ -1409,7 +1409,7 @@ def attachment_del(request, ticket_id, attachment_id):
raise PermissionDenied()
attachment = get_object_or_404(Attachment, id=attachment_id)
attachment.delete()
return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket_id]))
return HttpResponseRedirect(reverse('helpdesk:view', args=[ticket_id]))
attachment_del = staff_member_required(attachment_del)

View File

@ -82,10 +82,10 @@ class QuickDjangoTest(object):
"""
Fire up the Django test suite from before version 1.2
"""
settings.configure(DEBUG = True,
DATABASE_ENGINE = 'sqlite3',
DATABASE_NAME = os.path.join(self.DIRNAME, 'database.db'),
INSTALLED_APPS = self.INSTALLED_APPS + self.apps
settings.configure(DEBUG=True,
DATABASE_ENGINE='sqlite3',
DATABASE_NAME=os.path.join(self.DIRNAME, 'database.db'),
INSTALLED_APPS=self.INSTALLED_APPS + self.apps
)
from django.test.simple import run_tests
failures = run_tests(self.apps, verbosity=1)
@ -98,8 +98,8 @@ class QuickDjangoTest(object):
"""
settings.configure(
DEBUG = True,
DATABASES = {
DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(self.DIRNAME, 'database.db'),
@ -109,11 +109,11 @@ class QuickDjangoTest(object):
'PORT': '',
}
},
INSTALLED_APPS = self.INSTALLED_APPS + self.apps,
MIDDLEWARE_CLASSES = self.MIDDLEWARE_CLASSES,
ROOT_URLCONF = self.apps[0] + '.urls',
STATIC_URL = '/static/',
TEMPLATES = self.TEMPLATES,
INSTALLED_APPS=self.INSTALLED_APPS + self.apps,
MIDDLEWARE_CLASSES=self.MIDDLEWARE_CLASSES,
ROOT_URLCONF='helpdesk.tests.urls',
STATIC_URL='/static/',
TEMPLATES=self.TEMPLATES
)
# compatibility with django 1.8 downwards
@ -151,4 +151,3 @@ if __name__ == '__main__':
parser.add_argument('apps', nargs='+', type=str)
args = parser.parse_args()
QuickDjangoTest(*args.apps)