@treeio_login_required
@handle_response_format
def field_edit(request, field_id, response_format='html'):
 field = get_object_or_404(ItemField, pk=field_id)
 if (not request.user.profile.has_permission(field, mode='w')):
  return user_denied(request, message="You don't have access to this Field Type", response_format=response_format)
 if request.POST:
  if ('cancel' not in request.POST):
   form = ItemFieldForm(request.POST, instance=field)
   if form.is_valid():
    item = form.save(request)
    return HttpResponseRedirect(reverse('infrastructure_field_view', args=[item.id]))
  else:
   return HttpResponseRedirect(reverse('infrastructure_field_view', args=[item.id]))
 else:
  form = ItemFieldForm(instance=field)
 context = _get_default_context(request)
 context.update({'form': form, 'field': field})
 return render_to_response('infrastructure/field_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def field_edit ( request , field_id , response_format = 'html' ) : field = get_object_or_404 ( ItemField , pk = field_id ) if ( not request . user . profile . has_permission ( field , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Field Type" , response_format = response_format ) if request . POST : if ( 'cancel' not in request . POST ) : form = ItemFieldForm ( request . POST , instance = field ) if form . is_valid ( ) : item = form . save ( request ) return HttpResponseRedirect ( reverse ( 'infrastructure_field_view' , args = [ item . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'infrastructure_field_view' , args = [ item . id ] ) ) else : form = ItemFieldForm ( instance = field ) context = _get_default_context ( request ) context . update ( { 'form' : form , 'field' : field } ) return render_to_response ( 'infrastructure/field_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
itemfield edit .