@handle_response_format
@treeio_login_required
def ticket_edit(request, ticket_id, response_format='html'):
 context = _get_default_context(request)
 agent = context['agent']
 ticket = get_object_or_404(Ticket, pk=ticket_id)
 if (not request.user.profile.has_permission(ticket, mode='w')):
  return user_denied(request, message="You don't have access to this Ticket")
 if request.POST:
  if ('cancel' not in request.POST):
   form = TicketForm(request.user.profile, None, agent, request.POST, instance=ticket)
   if form.is_valid():
    ticket = form.save()
    return HttpResponseRedirect(reverse('services_ticket_view', args=[ticket.id]))
  else:
   return HttpResponseRedirect(reverse('services_ticket_view', args=[ticket.id]))
 else:
  form = TicketForm(request.user.profile, None, agent, instance=ticket)
 context.update({'form': form, 'ticket': ticket})
 return render_to_response('services/ticket_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def ticket_edit ( request , ticket_id , response_format = 'html' ) : context = _get_default_context ( request ) agent = context [ 'agent' ] ticket = get_object_or_404 ( Ticket , pk = ticket_id ) if ( not request . user . profile . has_permission ( ticket , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Ticket" ) if request . POST : if ( 'cancel' not in request . POST ) : form = TicketForm ( request . user . profile , None , agent , request . POST , instance = ticket ) if form . is_valid ( ) : ticket = form . save ( ) return HttpResponseRedirect ( reverse ( 'services_ticket_view' , args = [ ticket . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'services_ticket_view' , args = [ ticket . id ] ) ) else : form = TicketForm ( request . user . profile , None , agent , instance = ticket ) context . update ( { 'form' : form , 'ticket' : ticket } ) return render_to_response ( 'services/ticket_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
ticket edit .