@treeio_login_required
@handle_response_format
def event_edit(request, event_id, response_format='html'):
 event = get_object_or_404(Event, pk=event_id)
 if (not request.user.profile.has_permission(event, mode='w')):
  return user_denied(request, message="You don't have access to this Event")
 if request.POST:
  if ('cancel' not in request.POST):
   form = EventForm(request.user.profile, None, None, request.POST, instance=event)
   if form.is_valid():
    event = form.save()
    return HttpResponseRedirect(reverse('events_event_view', args=[event.id]))
  else:
   return HttpResponseRedirect(reverse('events'))
 else:
  form = EventForm(request.user.profile, instance=event)
 return render_to_response('events/event_edit', {'event': event, 'form': form}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def event_edit ( request , event_id , response_format = 'html' ) : event = get_object_or_404 ( Event , pk = event_id ) if ( not request . user . profile . has_permission ( event , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Event" ) if request . POST : if ( 'cancel' not in request . POST ) : form = EventForm ( request . user . profile , None , None , request . POST , instance = event ) if form . is_valid ( ) : event = form . save ( ) return HttpResponseRedirect ( reverse ( 'events_event_view' , args = [ event . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'events' ) ) else : form = EventForm ( request . user . profile , instance = event ) return render_to_response ( 'events/event_edit' , { 'event' : event , 'form' : form } , context_instance = RequestContext ( request ) , response_format = response_format )
event edit .