Fix issue #97 and issue #79:

* Errors with invalid page number for paginaton code
* Comment / Resolution not always saved.
This commit is contained in:
Ross Poulton 2009-08-18 12:12:35 +00:00
parent b492bd5bd2
commit 81591fdb40
2 changed files with 11 additions and 9 deletions

View File

@ -132,6 +132,7 @@ class TicketForm(forms.Form):
context = { context = {
'ticket': t, 'ticket': t,
'queue': q, 'queue': q,
'comment': f.comment,
} }
messages_sent_to = [] messages_sent_to = []

View File

@ -14,7 +14,7 @@ from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.files.base import ContentFile from django.core.files.base import ContentFile
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.paginator import Paginator from django.core import paginator
from django.db import connection from django.db import connection
from django.db.models import Q from django.db.models import Q
from django.http import HttpResponseRedirect, Http404, HttpResponse, HttpResponseForbidden from django.http import HttpResponseRedirect, Http404, HttpResponse, HttpResponseForbidden
@ -235,11 +235,12 @@ def update_ticket(request, ticket_id, public=False):
messages_sent_to = [] messages_sent_to = []
context.update(
resolution=ticket.resolution,
comment=f.comment,
)
if ticket.submitter_email and public and (f.comment or (f.new_status in (Ticket.RESOLVED_STATUS, Ticket.CLOSED_STATUS))): if ticket.submitter_email and public and (f.comment or (f.new_status in (Ticket.RESOLVED_STATUS, Ticket.CLOSED_STATUS))):
context.update(
resolution=ticket.resolution,
comment=f.comment,
)
if f.new_status == Ticket.RESOLVED_STATUS: if f.new_status == Ticket.RESOLVED_STATUS:
template = 'resolved_submitter' template = 'resolved_submitter'
@ -504,16 +505,16 @@ def ticket_list(request):
query_params['sortreverse'] = sortreverse query_params['sortreverse'] = sortreverse
ticket_qs = apply_query(Ticket.objects.select_related(), query_params) ticket_qs = apply_query(Ticket.objects.select_related(), query_params)
paginator = Paginator(ticket_qs, request.user.usersettings.settings.get('tickets_per_page', 20)) ticket_paginator = paginator.Paginator(ticket_qs, request.user.usersettings.settings.get('tickets_per_page', 20))
try: try:
page = int(request.GET.get('page', '1')) page = int(request.GET.get('page', '1'))
except ValueError: except ValueError:
page = 1 page = 1
try: try:
tickets = paginator.page(page) tickets = ticket_paginator.page(page)
except (EmptyPage, InvalidPage): except (paginator.EmptyPage, paginator.InvalidPage):
tickets = paginator.page(paginator.num_pages) tickets = ticket_paginator.page(ticket_paginator.num_pages)
search_message = '' search_message = ''
if context.has_key('query') and settings.DATABASE_ENGINE.startswith('sqlite'): if context.has_key('query') and settings.DATABASE_ENGINE.startswith('sqlite'):