diff options
Diffstat (limited to 'openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py')
-rw-r--r-- | openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py b/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py index 77c86c71..bd82666a 100644 --- a/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py +++ b/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py @@ -18,7 +18,7 @@ import json import logging from django.core.serializers.json import DjangoJSONEncoder -from django.core.urlresolvers import reverse_lazy +from django.core.urlresolvers import reverse, reverse_lazy from django.http import HttpResponse from django.utils.translation import ugettext_lazy as _ from django.views.generic import View @@ -47,12 +47,15 @@ class CreateView(forms.ModalFormView): class EditView(forms.ModalFormView): form_class = EditFlavor template_name = 'infrastructure/resource_management/flavors/edit.html' + form_url = 'horizon:infrastructure:resource_management:flavors:edit' success_url = reverse_lazy( 'horizon:infrastructure:resource_management:index') def get_context_data(self, **kwargs): context = super(EditView, self).get_context_data(**kwargs) context['flavor_id'] = self.kwargs['flavor_id'] + context['form_url'] = self.form_url + context['success_url'] = self.get_success_url() return context def get_initial(self): @@ -71,6 +74,15 @@ class EditView(forms.ModalFormView): 'swap_disk': flavor.swap_disk.value} +class DetailEditView(EditView): + form_url = 'horizon:infrastructure:resource_management:flavors:detail_edit' + success_url = 'horizon:infrastructure:resource_management:flavors:detail' + + def get_success_url(self): + return reverse(self.success_url, + args=(self.kwargs['flavor_id'],)) + + class DetailView(tabs.TabView): tab_group_class = FlavorDetailTabs template_name = 'infrastructure/resource_management/flavors/detail.html' |