@treeio_login_required
@handle_response_format
def location_edit(request, location_id, response_format='html'):
 location = get_object_or_404(Location, pk=location_id)
 if (not request.user.profile.has_permission(location, mode='w')):
  return user_denied(request, message="You don't have write access to this Location", response_format=response_format)
 if request.POST:
  if ('cancel' not in request.POST):
   form = LocationForm(request.user.profile, None, request.POST, instance=location)
   if form.is_valid():
    location = form.save(request)
    return HttpResponseRedirect(reverse('identities_location_view', args=[location.id]))
  else:
   return HttpResponseRedirect(reverse('identities_location_view', args=[location.id]))
 else:
  form = LocationForm(request.user.profile, None, instance=location)
 context = _get_default_context(request)
 context.update({'location': location, 'form': form})
 return render_to_response('identities/location_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def location_edit ( request , location_id , response_format = 'html' ) : location = get_object_or_404 ( Location , pk = location_id ) if ( not request . user . profile . has_permission ( location , mode = 'w' ) ) : return user_denied ( request , message = "You don't have write access to this Location" , response_format = response_format ) if request . POST : if ( 'cancel' not in request . POST ) : form = LocationForm ( request . user . profile , None , request . POST , instance = location ) if form . is_valid ( ) : location = form . save ( request ) return HttpResponseRedirect ( reverse ( 'identities_location_view' , args = [ location . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'identities_location_view' , args = [ location . id ] ) ) else : form = LocationForm ( request . user . profile , None , instance = location ) context = _get_default_context ( request ) context . update ( { 'location' : location , 'form' : form } ) return render_to_response ( 'identities/location_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
location edit page .