* Move to newforms-admin (compatible with Django 1.0 alphas)

* Changes to a few translation blocks; this is still a WIP.
This commit is contained in:
Ross Poulton 2008-08-11 23:24:18 +00:00
parent 23084499c1
commit c762313e08
9 changed files with 49 additions and 38 deletions

6
README
View File

@ -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.

26
admin.py Normal file
View File

@ -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)

View File

@ -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

View File

@ -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"<span class='priority%s'>%s</span>" % (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',]

View File

@ -4,7 +4,8 @@
<script type='text/javascript' language='javascript' src='{{ MEDIA_URL }}/helpdesk/hover.js'></script>
{% endblock %}
{% block helpdesk_body %}
<table width='30%'>
<table width='30%' align='left'>
<tr class='row_tablehead'><td colspan='4'>{% trans "Helpdesk Summary" %}</td></tr>
<tr class='row_columnheads'><th>{% trans "Queue" %}</th><th>{% trans "Open" %}</th><th>{% trans "Resolved" %}</th></tr>
{% for queue in dash_tickets %}
@ -16,6 +17,9 @@
{% endfor %}
</table>
<p style='padding-left: 5px;'>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?</p>
<br style='clear: both;' />
<table width='100%'>
<tr class='row_tablehead'><td colspan='6'>{% trans "Your Tickets" %}</td></tr>
@ -23,7 +27,7 @@
{% for ticket in user_tickets %}
<tr class='row_{% cycle odd,even %} row_hover'>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th>
<td><img src='{{ ticket.get_priority_img }}' alt='{% blocktrans with ticket.priority as priority %}Priority {{ priority }}{% endblocktrans %}' title='{% blocktrans with ticket.priority as priority %}Priority {{ priority }}{% endblocktrans %}' height='16' width='16' /></td>
<td>{{ ticket.get_priority_span }}</td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td>
<td>{{ ticket.get_status }}</td>
@ -38,11 +42,11 @@
{% for ticket in unassigned_tickets %}
<tr class='row_{% cycle odd,even %} row_hover'>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th>
<td><img src='{{ ticket.get_priority_img }}' alt='{% blocktrans with ticket.priority as priority %}Priority {{ priority }}{% endblocktrans %}' title='{% blocktrans with ticket.priority as priority %}Priority {{ priority }}{% endblocktrans %}' height='16' width='16' /></td>
<td>{{ ticket.get_priority_span }}</td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td>
<td><span title='{{ ticket.created|date:"r" }}'>{{ ticket.created|timesince }} ago</span></td>
<th><a href='{{ ticket.get_absolute_url }}?take'><img src='{{ MEDIA_URL }}/helpdesk/buttons/take.png' width='60' height='15' alt='{% trans "Take" %}' title='{% trans "Assign this ticket to yourself" %}' /></a></th>
<th><a href='{{ ticket.get_absolute_url }}?take'><span class='button button_take'>{% trans "Take" %}</span></a></th>
</tr>
{% endfor %}
</table>

View File

@ -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 %}
<h2>Delete Ticket</h2>
<p>Are you sure you want to delete this ticket (<em>{{ ticket.title }}</em>)? All traces of the ticket, including followups, attachments, and updates will be irreversably removed.</p>
<p>Are you sure you want to delete this ticket (<em>{{ ticket_title }}</em>)? All traces of the ticket, including followups, attachments, and updates will be irreversably removed.</p>
<p><a href='../'>No, Don't Delete It</a></p>

View File

@ -55,7 +55,7 @@
<tr class='row_even'>
<th>{% trans "Assigned To" %}</th>
<td>{{ ticket.get_assigned_to }}{% ifequal ticket.get_assigned_to _('Unassigned') %} <strong><a href='?take'><img src='{{ MEDIA_URL }}/helpdesk/buttons/take.png' width='60' height='15' alt='{% trans "Take" %}' title='{% trans "Assign this ticket to yourself" %}' /></a></strong>{% endifequal %}</td>
<td>{{ ticket.get_assigned_to }}{% ifequal ticket.get_assigned_to _('Unassigned') %} <strong><a href='?take'><span class='button button_take'>{% trans "Take" %}</span></a></strong>{% endifequal %}</td>
</tr>
<tr class='row_odd'>

View File

@ -60,7 +60,7 @@
{% if tickets %}{% for ticket in tickets %}
<tr class='row_{% cycle odd,even %} row_hover'>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.ticket }}</a></th>
<td><img src='{{ ticket.get_priority_img }}' alt='{% trans "Priority {{ ticket.priority }}" %}' title='{% trans "Priority {{ ticket.priority }}" %}' height='16' width='16' /></td>
<td>{{ ticket.get_priority_span }}</td>
<th><a href='{{ ticket.get_absolute_url }}'>{{ ticket.title }}</a></th>
<td>{{ ticket.queue }}</td>
<td>{{ ticket.get_status }}</td>

View File

@ -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