@handle_response_format
@treeio_login_required
def field_delete(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 write access to this ItemField")
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    field.trash = True
    field.save()
   else:
    field.delete()
   return HttpResponseRedirect(reverse('infrastructure_settings_view'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('infrastructure_field_view', args=[field.id]))
 context = _get_default_context(request)
 context.update({'field': field})
 return render_to_response('infrastructure/field_delete', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def field_delete ( 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 write access to this ItemField" ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : field . trash = True field . save ( ) else : field . delete ( ) return HttpResponseRedirect ( reverse ( 'infrastructure_settings_view' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'infrastructure_field_view' , args = [ field . id ] ) ) context = _get_default_context ( request ) context . update ( { 'field' : field } ) return render_to_response ( 'infrastructure/field_delete' , context , context_instance = RequestContext ( request ) , response_format = response_format )
itemfield delete page .