remove duplicate code
This commit is contained in:
parent
81fb88615f
commit
5c6aeb8fa2
@ -86,22 +86,17 @@ def update(request, tenant_id):
|
|||||||
if handled:
|
if handled:
|
||||||
return handled
|
return handled
|
||||||
|
|
||||||
if request.POST:
|
if request.method == 'GET':
|
||||||
return render_to_response(
|
|
||||||
'syspanel_tenant_update.html',{
|
|
||||||
'form': form,
|
|
||||||
}, context_instance = template.RequestContext(request))
|
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
tenant = api.account_api(request).tenants.get(tenant_id)
|
tenant = api.account_api(request).tenants.get(tenant_id)
|
||||||
form = UpdateTenant(initial={'id': tenant.id,
|
form = UpdateTenant(initial={'id': tenant.id,
|
||||||
'description': tenant.description,
|
'description': tenant.description,
|
||||||
'enabled': tenant.enabled})
|
'enabled': tenant.enabled})
|
||||||
return render_to_response(
|
|
||||||
'syspanel_tenant_update.html',{
|
|
||||||
'form': form,
|
|
||||||
}, context_instance = template.RequestContext(request))
|
|
||||||
except api_exceptions.ApiException, e:
|
except api_exceptions.ApiException, e:
|
||||||
messages.error(request, 'Unable to update tenant: %s' % e.message)
|
messages.error(request, 'Unable to update tenant: %s' % e.message)
|
||||||
return redirect('syspanel_tenants')
|
return redirect('syspanel_tenants')
|
||||||
|
|
||||||
|
return render_to_response(
|
||||||
|
'syspanel_tenant_update.html',{
|
||||||
|
'form': form,
|
||||||
|
}, context_instance = template.RequestContext(request))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user