diff --git a/README b/README index cd4a2b0d..17e2bf1f 100644 --- a/README +++ b/README @@ -25,7 +25,7 @@ LICENSE.JQUERY and LICENSE.NICEDIT for their respective license terms. ######################### 1. Python 2.3+ -2. Django (post-0.96, eg SVN checkout) +2. Django (1.0 alpha 1 or newer, or an SVN checkout after 7941). 3. An existing WORKING Django project with database etc. If you cannot log into the Admin, you won't get this product working. @@ -53,7 +53,9 @@ LICENSE.JQUERY and LICENSE.NICEDIT for their respective license terms. 4. Ensure the admin line is un-hashed in urls.py: # Uncomment this for admin: - (r'^admin/', include('django.contrib.admin.urls')), + from django.contrib import admin + admin.autodiscover() + (r'^admin/(.*)', admin.site.root), If you use helpdesk at the top of your domain (at /), ensure the admin line comes BEFORE the helpdesk line. diff --git a/admin.py b/admin.py new file mode 100644 index 00000000..97802584 --- /dev/null +++ b/admin.py @@ -0,0 +1,26 @@ +from django.contrib import admin +from helpdesk.models import Queue, Ticket, FollowUp, PreSetReply, KBCategory +from helpdesk.models import EscalationExclusion, EmailTemplate, KBItem + +class QueueAdmin(admin.ModelAdmin): + list_display = ('title', 'slug', 'email_address') + +class TicketAdmin(admin.ModelAdmin): + list_display = ('title', 'status', 'assigned_to', 'submitter_email',) + date_hierarchy = 'created' + list_filter = ('assigned_to', 'status', ) + +class GenericAdmin(admin.ModelAdmin): + pass + +class PreSetReplyAdmin(admin.ModelAdmin): + list_display = ('name',) + +admin.site.register(Ticket, TicketAdmin) +admin.site.register(Queue, QueueAdmin) +admin.site.register(FollowUp, GenericAdmin) +admin.site.register(PreSetReply, GenericAdmin) +admin.site.register(EscalationExclusion, GenericAdmin) +admin.site.register(EmailTemplate, GenericAdmin) +admin.site.register(KBCategory, GenericAdmin) +admin.site.register(KBItem, GenericAdmin) diff --git a/forms.py b/forms.py index e18436b8..d87e5539 100644 --- a/forms.py +++ b/forms.py @@ -7,7 +7,7 @@ forms.py - Definitions of newforms-based forms for creating and maintaining tickets. """ -from django import newforms as forms +from django import forms from helpdesk.models import Ticket, Queue, FollowUp from django.contrib.auth.models import User from datetime import datetime diff --git a/models.py b/models.py index dd40be39..ec89ebfa 100644 --- a/models.py +++ b/models.py @@ -55,9 +55,6 @@ class Queue(models.Model): def __unicode__(self): return u"%s" % self.title - class Admin: - list_display = ('title', 'slug', 'email_address') - class Meta: ordering = ('title',) @@ -150,6 +147,11 @@ class Ticket(models.Model): return u"%s/helpdesk/priorities/priority%s.png" % (settings.MEDIA_URL, self.priority) get_priority_img = property(_get_priority_img) + def _get_priority_span(self): + from django.utils.safestring import mark_safe + return mark_safe(u"%s" % (self.priority, self.priority)) + get_priority_span = property(_get_priority_span) + def _get_status(self): held_msg = '' if self.on_hold: held_msg = _(' - On Hold') @@ -170,11 +172,6 @@ class Ticket(models.Model): return u"http://%s%s" % (site.domain, reverse('helpdesk_view', args=[self.id])) staff_url = property(_get_staff_url) - class Admin: - list_display = ('title', 'status', 'assigned_to', 'submitter_email',) - date_hierarchy = 'created' - list_filter = ('assigned_to', 'status', ) - class Meta: get_latest_by = "created" @@ -229,9 +226,6 @@ class FollowUp(models.Model): class Meta: ordering = ['date'] - class Admin: - pass - def __unicode__(self): return u'%s' % self.title @@ -323,9 +317,6 @@ class PreSetReply(models.Model): name = models.CharField(_('Name'), max_length=100, help_text=_('Only used to assist users with selecting a reply - not shown to the user.')) body = models.TextField(_('Body'), help_text=_('Context available: {{ ticket }} - ticket object (eg {{ ticket.title }}); {{ queue }} - The queue; and {{ user }} - the current user.')) - class Admin: - list_display = ('name',) - class Meta: ordering = ['name',] @@ -339,9 +330,6 @@ class EscalationExclusion(models.Model): date = models.DateField(_('Date'), help_text=_('Date on which escalation should not happen')) - class Admin: - pass - def __unicode__(self): return u'%s' % self.name @@ -358,9 +346,6 @@ class EmailTemplate(models.Model): plain_text = models.TextField(_('Plain Text'), help_text=_('The context available to you includes {{ ticket }}, {{ queue }}, and depending on the time of the call: {{ resolution }} or {{ comment }}.')) html = models.TextField(_('HTML'), help_text=_('The same context is available here as in plain_text, above.')) - class Admin: - pass - def __unicode__(self): return u'%s' % self.template_name @@ -380,9 +365,6 @@ class KBCategory(models.Model): def __unicode__(self): return u'%s' % self.title - class Admin: - pass - class Meta: ordering = ['title',] @@ -419,9 +401,6 @@ class KBItem(models.Model): def __unicode__(self): return u'%s' % self.title - class Admin: - pass - class Meta: ordering = ['title',] diff --git a/templates/helpdesk/dashboard.html b/templates/helpdesk/dashboard.html index 42469daf..529e76c8 100644 --- a/templates/helpdesk/dashboard.html +++ b/templates/helpdesk/dashboard.html @@ -4,7 +4,8 @@ {% endblock %} {% block helpdesk_body %} - + +
{% for queue in dash_tickets %} @@ -16,6 +17,9 @@ {% endfor %}
{% trans "Helpdesk Summary" %}
{% trans "Queue" %}{% trans "Open" %}{% trans "Resolved" %}
+

Welcome to your Helpdesk Dashboard! From here you can quickly see your own tickets, and those tickets that have no owner. Why not pick up an orphan ticket and sort it out for a customer?

+ +
@@ -23,7 +27,7 @@ {% for ticket in user_tickets %} - + @@ -38,11 +42,11 @@ {% for ticket in unassigned_tickets %} - + - + {% endfor %}
{% trans "Your Tickets" %}
{{ ticket.ticket }}{% blocktrans with ticket.priority as priority %}Priority {{ priority }}{% endblocktrans %}{{ ticket.get_priority_span }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.get_status }}
{{ ticket.ticket }}{% blocktrans with ticket.priority as priority %}Priority {{ priority }}{% endblocktrans %}{{ ticket.get_priority_span }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.created|timesince }} ago{% trans "Take" %}{% trans "Take" %}
diff --git a/templates/helpdesk/delete_ticket.html b/templates/helpdesk/delete_ticket.html index 4dd3d8d7..67a549d1 100644 --- a/templates/helpdesk/delete_ticket.html +++ b/templates/helpdesk/delete_ticket.html @@ -2,10 +2,10 @@ {% block helpdesk_title %}{% trans "Delete Ticket" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans %} +{% block helpdesk_body %}{% blocktrans with ticket.title as ticket_title %}

Delete Ticket

-

Are you sure you want to delete this ticket ({{ ticket.title }})? All traces of the ticket, including followups, attachments, and updates will be irreversably removed.

+

Are you sure you want to delete this ticket ({{ ticket_title }})? All traces of the ticket, including followups, attachments, and updates will be irreversably removed.

No, Don't Delete It

diff --git a/templates/helpdesk/ticket.html b/templates/helpdesk/ticket.html index ffdc03af..519fbcb2 100644 --- a/templates/helpdesk/ticket.html +++ b/templates/helpdesk/ticket.html @@ -55,7 +55,7 @@ {% trans "Assigned To" %} - {{ ticket.get_assigned_to }}{% ifequal ticket.get_assigned_to _('Unassigned') %} {% trans "Take" %}{% endifequal %} + {{ ticket.get_assigned_to }}{% ifequal ticket.get_assigned_to _('Unassigned') %} {% trans "Take" %}{% endifequal %} diff --git a/templates/helpdesk/ticket_list.html b/templates/helpdesk/ticket_list.html index 888851d5..7f772612 100644 --- a/templates/helpdesk/ticket_list.html +++ b/templates/helpdesk/ticket_list.html @@ -60,7 +60,7 @@ {% if tickets %}{% for ticket in tickets %} {{ ticket.ticket }} -{% trans "Priority {{ ticket.priority }}" %} +{{ ticket.get_priority_span }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.get_status }} diff --git a/views/api.py b/views/api.py index 1e5c622f..243fcc85 100644 --- a/views/api.py +++ b/views/api.py @@ -18,7 +18,7 @@ from django.contrib.auth import authenticate from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import loader, Context -from django import newforms as forms +from django import forms from helpdesk.lib import send_templated_mail from helpdesk.models import Ticket, Queue, FollowUp