diff --git a/horizon/tables/views.py b/horizon/tables/views.py index 9c68012e23..6d78b5cfec 100644 --- a/horizon/tables/views.py +++ b/horizon/tables/views.py @@ -240,6 +240,7 @@ class DataTableView(MultiTableView): """ table_class = None context_object_name = 'table' + template_name = 'horizon/common/_data_table_view.html' def _get_data_dict(self): if not self._data: diff --git a/horizon/templates/horizon/common/_data_table_view.html b/horizon/templates/horizon/common/_data_table_view.html new file mode 100644 index 0000000000..c8c6316cc1 --- /dev/null +++ b/horizon/templates/horizon/common/_data_table_view.html @@ -0,0 +1,3 @@ +{% extends 'base.html' %} +{% block title %}{{ page_title }}{% endblock %} +{% block main %}{{ table.render }}{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/flavors/constants.py b/openstack_dashboard/dashboards/admin/flavors/constants.py index 4f6ffcee4e..00b23d9ffe 100644 --- a/openstack_dashboard/dashboards/admin/flavors/constants.py +++ b/openstack_dashboard/dashboards/admin/flavors/constants.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -FLAVORS_TEMPLATE_NAME = 'admin/flavors/index.html' +FLAVORS_TEMPLATE_NAME = 'horizon/common/_data_table_view.html' FLAVORS_INDEX_URL = 'horizon:admin:flavors:index' FLAVORS_CREATE_URL = 'horizon:admin:flavors:create' FLAVORS_CREATE_VIEW_TEMPLATE = 'admin/flavors/create.html' diff --git a/openstack_dashboard/dashboards/admin/flavors/templates/flavors/index.html b/openstack_dashboard/dashboards/admin/flavors/templates/flavors/index.html deleted file mode 100644 index 832b6fa33e..0000000000 --- a/openstack_dashboard/dashboards/admin/flavors/templates/flavors/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Flavors" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/flavors/views.py b/openstack_dashboard/dashboards/admin/flavors/views.py index 0bfc44ed5c..0ca15878ae 100644 --- a/openstack_dashboard/dashboards/admin/flavors/views.py +++ b/openstack_dashboard/dashboards/admin/flavors/views.py @@ -36,7 +36,6 @@ INDEX_URL = "horizon:admin:flavors:index" class IndexView(tables.DataTableView): table_class = project_tables.FlavorsTable - template_name = 'admin/flavors/index.html' page_title = _("Flavors") def has_prev_data(self, table): diff --git a/openstack_dashboard/dashboards/admin/floating_ips/templates/floating_ips/index.html b/openstack_dashboard/dashboards/admin/floating_ips/templates/floating_ips/index.html deleted file mode 100644 index 24dbc00d6a..0000000000 --- a/openstack_dashboard/dashboards/admin/floating_ips/templates/floating_ips/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Floating IPs" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/floating_ips/tests.py b/openstack_dashboard/dashboards/admin/floating_ips/tests.py index a67b9018c6..092df4118f 100644 --- a/openstack_dashboard/dashboards/admin/floating_ips/tests.py +++ b/openstack_dashboard/dashboards/admin/floating_ips/tests.py @@ -21,6 +21,7 @@ from openstack_dashboard import api from openstack_dashboard.test import helpers as test INDEX_URL = reverse('horizon:admin:floating_ips:index') +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' class AdminFloatingIpViewTest(test.BaseAdminViewTests): @@ -46,7 +47,7 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/floating_ips/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertIn('floating_ips_table', res.context) floating_ips_table = res.context['floating_ips_table'] floating_ips = floating_ips_table.data @@ -96,7 +97,7 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/floating_ips/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) @test.create_stubs({api.network: ('tenant_floating_ip_list', )}) def test_index_error(self): @@ -106,7 +107,7 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/floating_ips/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) @test.create_stubs({api.neutron: ('network_list',), api.keystone: ('tenant_list',)}) @@ -261,7 +262,7 @@ class AdminFloatingIpViewTest(test.BaseAdminViewTests): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/floating_ips/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertIn('floating_ips_table', res.context) floating_ips_table = res.context['floating_ips_table'] floating_ips = floating_ips_table.data diff --git a/openstack_dashboard/dashboards/admin/floating_ips/views.py b/openstack_dashboard/dashboards/admin/floating_ips/views.py index 78b1d02a46..e84ac7a2d6 100644 --- a/openstack_dashboard/dashboards/admin/floating_ips/views.py +++ b/openstack_dashboard/dashboards/admin/floating_ips/views.py @@ -59,7 +59,6 @@ def get_tenant_list(request): class IndexView(tables.DataTableView): table_class = fip_tables.FloatingIPsTable - template_name = 'admin/floating_ips/index.html' page_title = _("Floating IPs") @memoized.memoized_method diff --git a/openstack_dashboard/dashboards/admin/hypervisors/tests.py b/openstack_dashboard/dashboards/admin/hypervisors/tests.py index 647e11e546..628c1f72df 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/tests.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/tests.py @@ -41,7 +41,7 @@ class HypervisorViewTest(test.BaseAdminViewTests): self.mox.ReplayAll() res = self.client.get(reverse('horizon:admin:hypervisors:index')) - self.assertTemplateUsed(res, 'admin/hypervisors/index.html') + self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html') hypervisors_tab = res.context['tab_group'].get_tab('hypervisor') self.assertItemsEqual(hypervisors_tab._tables['hypervisors'].data, diff --git a/openstack_dashboard/dashboards/admin/hypervisors/views.py b/openstack_dashboard/dashboards/admin/hypervisors/views.py index 5e770f6e27..2fc35202bd 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/views.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/views.py @@ -27,7 +27,7 @@ from openstack_dashboard.dashboards.admin.hypervisors \ class AdminIndexView(tabs.TabbedTableView): tab_group_class = project_tabs.HypervisorHostTabs - template_name = 'admin/hypervisors/index.html' + template_name = 'horizon/common/_data_table_view.html' page_title = _("All Hypervisors") def get_context_data(self, **kwargs): diff --git a/openstack_dashboard/dashboards/admin/images/templates/images/index.html b/openstack_dashboard/dashboards/admin/images/templates/images/index.html deleted file mode 100644 index 951371931c..0000000000 --- a/openstack_dashboard/dashboards/admin/images/templates/images/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Images" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/images/tests.py b/openstack_dashboard/dashboards/admin/images/tests.py index 9ec4a17798..dfe09e94eb 100644 --- a/openstack_dashboard/dashboards/admin/images/tests.py +++ b/openstack_dashboard/dashboards/admin/images/tests.py @@ -24,6 +24,8 @@ from openstack_dashboard.test import helpers as test from openstack_dashboard.dashboards.admin.images import tables +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' + class ImageCreateViewTest(test.BaseAdminViewTests): @test.create_stubs({api.glance: ('image_list_detailed',)}) @@ -64,14 +66,14 @@ class ImagesViewTest(test.BaseAdminViewTests): res = self.client.get( reverse('horizon:admin:images:index')) self.assertContains(res, 'test_tenant', 9, 200) - self.assertTemplateUsed(res, 'admin/images/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertEqual(len(res.context['images_table'].data), len(self.images.list())) @test.update_settings(FILTER_DATA_FIRST={'admin.images': True}) def test_images_list_with_admin_filter_first(self): res = self.client.get(reverse('horizon:admin:images:index')) - self.assertTemplateUsed(res, 'admin/images/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) images = res.context['table'].data self.assertItemsEqual(images, []) @@ -110,7 +112,7 @@ class ImagesViewTest(test.BaseAdminViewTests): # get all self.assertEqual(len(res.context['images_table'].data), len(images)) - self.assertTemplateUsed(res, 'admin/images/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertContains(res, 'test_tenant', 7, 200) res = self.client.get(url) @@ -174,7 +176,7 @@ class ImagesViewTest(test.BaseAdminViewTests): # get all self.assertEqual(len(res.context['images_table'].data), len(images)) - self.assertTemplateUsed(res, 'admin/images/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertContains(res, 'test_tenant', 5, 200) res = self.client.get(url) diff --git a/openstack_dashboard/dashboards/admin/images/views.py b/openstack_dashboard/dashboards/admin/images/views.py index 799f2f7d8a..7bc4dcdcec 100644 --- a/openstack_dashboard/dashboards/admin/images/views.py +++ b/openstack_dashboard/dashboards/admin/images/views.py @@ -44,7 +44,6 @@ LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): DEFAULT_FILTERS = {'is_public': None} table_class = project_tables.AdminImagesTable - template_name = 'admin/images/index.html' page_title = _("Images") def has_prev_data(self, table): diff --git a/openstack_dashboard/dashboards/admin/instances/templates/instances/index.html b/openstack_dashboard/dashboards/admin/instances/templates/instances/index.html deleted file mode 100644 index 24234bcf7a..0000000000 --- a/openstack_dashboard/dashboards/admin/instances/templates/instances/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Instances" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/instances/tests.py b/openstack_dashboard/dashboards/admin/instances/tests.py index 79db385377..fda9d69cdb 100644 --- a/openstack_dashboard/dashboards/admin/instances/tests.py +++ b/openstack_dashboard/dashboards/admin/instances/tests.py @@ -26,6 +26,7 @@ from openstack_dashboard.test import helpers as test INDEX_URL = reverse('horizon:admin:instances:index') +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' class InstanceViewTest(test.BaseAdminViewTests): @@ -58,7 +59,7 @@ class InstanceViewTest(test.BaseAdminViewTests): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) instances = res.context['table'].data self.assertItemsEqual(instances, servers) @@ -95,7 +96,7 @@ class InstanceViewTest(test.BaseAdminViewTests): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) instances = res.context['table'].data self.assertItemsEqual(instances, servers) @@ -138,7 +139,7 @@ class InstanceViewTest(test.BaseAdminViewTests): res = self.client.get(INDEX_URL) instances = res.context['table'].data - self.assertTemplateUsed(res, 'admin/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) # Since error messages produced for each instance are identical, # there will be only one error message for all instances # (messages de-duplication). @@ -163,7 +164,7 @@ class InstanceViewTest(test.BaseAdminViewTests): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertEqual(len(res.context['instances_table'].data), 0) @test.create_stubs({api.nova: ('server_get', 'flavor_get', @@ -430,6 +431,6 @@ class InstanceViewTest(test.BaseAdminViewTests): @test.update_settings(FILTER_DATA_FIRST={'admin.instances': True}) def test_index_with_admin_filter_first(self): res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) instances = res.context['table'].data self.assertItemsEqual(instances, []) diff --git a/openstack_dashboard/dashboards/admin/instances/views.py b/openstack_dashboard/dashboards/admin/instances/views.py index daa29f190b..0f1aaf767a 100644 --- a/openstack_dashboard/dashboards/admin/instances/views.py +++ b/openstack_dashboard/dashboards/admin/instances/views.py @@ -72,7 +72,6 @@ class AdminUpdateView(views.UpdateView): class AdminIndexView(tables.DataTableView): table_class = project_tables.AdminInstancesTable - template_name = 'admin/instances/index.html' page_title = _("Instances") def has_more_data(self, table): diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/constants.py b/openstack_dashboard/dashboards/admin/metadata_defs/constants.py index 4dec513b55..b2598b7b79 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/constants.py +++ b/openstack_dashboard/dashboards/admin/metadata_defs/constants.py @@ -20,7 +20,7 @@ METADATA_DETAIL_OVERVIEW_TEMPLATE = "admin/metadata_defs/_detail_overview.html" METADATA_DETAIL_CONTENTS_TEMPLATE = "admin/metadata_defs/_detail_contents.html" METADATA_DETAIL_TEMPLATE = 'horizon/common/_detail.html' METADATA_DETAIL_URL = "horizon:admin:metadata_defs:detail" -METADATA_INDEX_TEMPLATE = 'admin/metadata_defs/index.html' +METADATA_INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' METADATA_INDEX_URL = 'horizon:admin:metadata_defs:index' METADATA_MANAGE_RESOURCES_TEMPLATE = 'admin/metadata_defs/resource_types.html' METADATA_MANAGE_RESOURCES_URL = 'horizon:admin:metadata_defs:resource_types' diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/index.html b/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/index.html deleted file mode 100644 index 8616529976..0000000000 --- a/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Metadata Definitions" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/networks/templates/networks/index.html b/openstack_dashboard/dashboards/admin/networks/templates/networks/index.html deleted file mode 100644 index df92ca98fc..0000000000 --- a/openstack_dashboard/dashboards/admin/networks/templates/networks/index.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Networks" %}{% endblock %} - -{% block main %} -
- {{ networks_table.render }} -
- -
- {{ subnets_table.render }} -
- -
- {{ ports_table.render }} -
-{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/networks/tests.py b/openstack_dashboard/dashboards/admin/networks/tests.py index 949bd7847f..eb220f696d 100644 --- a/openstack_dashboard/dashboards/admin/networks/tests.py +++ b/openstack_dashboard/dashboards/admin/networks/tests.py @@ -23,7 +23,7 @@ from mox3.mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test - +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' INDEX_URL = reverse('horizon:admin:networks:index') @@ -53,7 +53,7 @@ class NetworkTests(test.BaseAdminViewTests): res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/networks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) networks = res.context['networks_table'].data self.assertItemsEqual(networks, self.networks.list()) @@ -70,7 +70,7 @@ class NetworkTests(test.BaseAdminViewTests): res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'admin/networks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertEqual(len(res.context['networks_table'].data), 0) self.assertMessageCount(res, error=1) @@ -769,6 +769,6 @@ class NetworkTests(test.BaseAdminViewTests): 'dhcp_agent_scheduler').AndReturn(True) self.mox.ReplayAll() res = self.client.get(reverse('horizon:admin:networks:index')) - self.assertTemplateUsed(res, 'admin/networks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) networks = res.context['networks_table'].data self.assertItemsEqual(networks, []) diff --git a/openstack_dashboard/dashboards/admin/networks/views.py b/openstack_dashboard/dashboards/admin/networks/views.py index 16ff433baa..773a342af8 100644 --- a/openstack_dashboard/dashboards/admin/networks/views.py +++ b/openstack_dashboard/dashboards/admin/networks/views.py @@ -43,7 +43,6 @@ from openstack_dashboard.dashboards.admin.networks \ class IndexView(tables.DataTableView): table_class = networks_tables.NetworksTable - template_name = 'admin/networks/index.html' page_title = _("Networks") FILTERS_MAPPING = {'shared': {_("yes"): True, _("no"): False}, 'router:external': {_("yes"): True, _("no"): False}, diff --git a/openstack_dashboard/dashboards/admin/routers/templates/routers/index.html b/openstack_dashboard/dashboards/admin/routers/templates/routers/index.html deleted file mode 100644 index 88ed3111c9..0000000000 --- a/openstack_dashboard/dashboards/admin/routers/templates/routers/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Routers" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/admin/routers/tests.py b/openstack_dashboard/dashboards/admin/routers/tests.py index f396ff8cce..b27947052a 100644 --- a/openstack_dashboard/dashboards/admin/routers/tests.py +++ b/openstack_dashboard/dashboards/admin/routers/tests.py @@ -22,6 +22,8 @@ from openstack_dashboard import api from openstack_dashboard.dashboards.project.routers import tests as r_test from openstack_dashboard.test import helpers as test +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' + class RouterTests(test.BaseAdminViewTests, r_test.RouterTests): DASHBOARD = 'admin' @@ -47,7 +49,7 @@ class RouterTests(test.BaseAdminViewTests, r_test.RouterTests): res = self.client.get(self.INDEX_URL) - self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD) + self.assertTemplateUsed(res, INDEX_TEMPLATE) routers = res.context['table'].data self.assertItemsEqual(routers, self.routers.list()) @@ -60,7 +62,7 @@ class RouterTests(test.BaseAdminViewTests, r_test.RouterTests): res = self.client.get(self.INDEX_URL) - self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD) + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertEqual(len(res.context['table'].data), 0) self.assertMessageCount(res, error=1) @@ -87,7 +89,7 @@ class RouterTests(test.BaseAdminViewTests, r_test.RouterTests): args=[agent.id]) res = self.client.get(l3_list_url) - self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD) + self.assertTemplateUsed(res, INDEX_TEMPLATE) routers = res.context['table'].data self.assertItemsEqual(routers, self.routers.list()) @@ -108,7 +110,7 @@ class RouterTests(test.BaseAdminViewTests, r_test.RouterTests): self.assertEqual(len(table_data), 1) self.assertIn('(Not Found)', table_data[0]['external_gateway_info']['network']) - self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD) + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertMessageCount(res, error=1) @test.create_stubs({api.neutron: ('router_list', 'network_list', @@ -191,7 +193,7 @@ class RouterTests(test.BaseAdminViewTests, r_test.RouterTests): @test.update_settings(FILTER_DATA_FIRST={'admin.routers': True}) def test_routers_list_with_admin_filter_first(self): res = self.client.get(self.INDEX_URL) - self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD) + self.assertTemplateUsed(res, INDEX_TEMPLATE) routers = res.context['table'].data self.assertItemsEqual(routers, []) diff --git a/openstack_dashboard/dashboards/admin/routers/views.py b/openstack_dashboard/dashboards/admin/routers/views.py index 5541338d30..af0d2e8363 100644 --- a/openstack_dashboard/dashboards/admin/routers/views.py +++ b/openstack_dashboard/dashboards/admin/routers/views.py @@ -31,7 +31,7 @@ from openstack_dashboard.dashboards.project.routers import views as r_views class IndexView(r_views.IndexView, n_views.IndexView): table_class = rtbl.RoutersTable - template_name = 'admin/routers/index.html' + template_name = 'horizon/common/_data_table_view.html' FILTERS_MAPPING = {'admin_state_up': {_("up"): True, _("down"): False}} def needs_filter_first(self, table): diff --git a/openstack_dashboard/dashboards/identity/identity_providers/templates/identity_providers/index.html b/openstack_dashboard/dashboards/identity/identity_providers/templates/identity_providers/index.html deleted file mode 100644 index 24609ff1fc..0000000000 --- a/openstack_dashboard/dashboards/identity/identity_providers/templates/identity_providers/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Identity Providers" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/identity/identity_providers/tests.py b/openstack_dashboard/dashboards/identity/identity_providers/tests.py index 49532bf36a..34767120f8 100644 --- a/openstack_dashboard/dashboards/identity/identity_providers/tests.py +++ b/openstack_dashboard/dashboards/identity/identity_providers/tests.py @@ -40,7 +40,7 @@ class IdPsViewTests(test.BaseAdminViewTests): res = self.client.get(IDPS_INDEX_URL) - self.assertTemplateUsed(res, 'identity/identity_providers/index.html') + self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html') self.assertItemsEqual(res.context['table'].data, self.identity_providers.list()) diff --git a/openstack_dashboard/dashboards/identity/identity_providers/views.py b/openstack_dashboard/dashboards/identity/identity_providers/views.py index 039e261b78..f75abc3841 100644 --- a/openstack_dashboard/dashboards/identity/identity_providers/views.py +++ b/openstack_dashboard/dashboards/identity/identity_providers/views.py @@ -36,7 +36,6 @@ from openstack_dashboard.dashboards.identity.identity_providers \ class IndexView(tables.DataTableView): table_class = idp_tables.IdentityProvidersTable - template_name = 'identity/identity_providers/index.html' page_title = _("Identity Providers") def get_data(self): diff --git a/openstack_dashboard/dashboards/identity/mappings/templates/mappings/index.html b/openstack_dashboard/dashboards/identity/mappings/templates/mappings/index.html deleted file mode 100644 index a75343ca0a..0000000000 --- a/openstack_dashboard/dashboards/identity/mappings/templates/mappings/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Mappings" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/identity/mappings/tests.py b/openstack_dashboard/dashboards/identity/mappings/tests.py index 4d7fca6451..c9f2dce76f 100644 --- a/openstack_dashboard/dashboards/identity/mappings/tests.py +++ b/openstack_dashboard/dashboards/identity/mappings/tests.py @@ -40,7 +40,7 @@ class MappingsViewTests(test.BaseAdminViewTests): res = self.client.get(MAPPINGS_INDEX_URL) - self.assertTemplateUsed(res, 'identity/mappings/index.html') + self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html') self.assertItemsEqual(res.context['table'].data, self.idp_mappings.list()) diff --git a/openstack_dashboard/dashboards/identity/mappings/views.py b/openstack_dashboard/dashboards/identity/mappings/views.py index 29e6c4a096..ee45bc00c0 100644 --- a/openstack_dashboard/dashboards/identity/mappings/views.py +++ b/openstack_dashboard/dashboards/identity/mappings/views.py @@ -35,7 +35,6 @@ from openstack_dashboard.dashboards.identity.mappings \ class IndexView(tables.DataTableView): table_class = mapping_tables.MappingsTable - template_name = 'identity/mappings/index.html' page_title = _("Mappings") def get_data(self): diff --git a/openstack_dashboard/dashboards/identity/roles/templates/roles/index.html b/openstack_dashboard/dashboards/identity/roles/templates/roles/index.html deleted file mode 100644 index 7545a2d482..0000000000 --- a/openstack_dashboard/dashboards/identity/roles/templates/roles/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Roles" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/identity/roles/tests.py b/openstack_dashboard/dashboards/identity/roles/tests.py index 1010026032..5fa2112256 100644 --- a/openstack_dashboard/dashboards/identity/roles/tests.py +++ b/openstack_dashboard/dashboards/identity/roles/tests.py @@ -25,6 +25,7 @@ from openstack_dashboard.test import helpers as test ROLES_INDEX_URL = reverse('horizon:identity:roles:index') ROLES_CREATE_URL = reverse('horizon:identity:roles:create') ROLES_UPDATE_URL = reverse('horizon:identity:roles:update', args=[1]) +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' class RolesViewTests(test.BaseAdminViewTests): @@ -43,7 +44,7 @@ class RolesViewTests(test.BaseAdminViewTests): self.assertContains(res, 'Edit') self.assertContains(res, 'Delete Role') - self.assertTemplateUsed(res, 'identity/roles/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertItemsEqual(res.context['table'].data, self.roles.list()) @test.create_stubs({api.keystone: ('role_list', @@ -64,7 +65,7 @@ class RolesViewTests(test.BaseAdminViewTests): self.assertNotContains(res, 'Edit') self.assertNotContains(res, 'Delete Role') - self.assertTemplateUsed(res, 'identity/roles/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertItemsEqual(res.context['table'].data, self.roles.list()) @test.create_stubs({api.keystone: ('role_create', )}) diff --git a/openstack_dashboard/dashboards/identity/roles/views.py b/openstack_dashboard/dashboards/identity/roles/views.py index feb92ca4ba..26c8d80380 100644 --- a/openstack_dashboard/dashboards/identity/roles/views.py +++ b/openstack_dashboard/dashboards/identity/roles/views.py @@ -33,7 +33,6 @@ from openstack_dashboard.dashboards.identity.roles \ class IndexView(tables.DataTableView): table_class = project_tables.RolesTable - template_name = 'identity/roles/index.html' page_title = _("Roles") def get_data(self): diff --git a/openstack_dashboard/dashboards/project/images/templates/images/index.html b/openstack_dashboard/dashboards/project/images/templates/images/index.html deleted file mode 100644 index 951371931c..0000000000 --- a/openstack_dashboard/dashboards/project/images/templates/images/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Images" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/images/tests.py b/openstack_dashboard/dashboards/project/images/tests.py index 9b62b68111..fe0a244e7c 100644 --- a/openstack_dashboard/dashboards/project/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/tests.py @@ -37,6 +37,7 @@ from openstack_dashboard.dashboards.project.images import utils from openstack_dashboard.test import helpers as test +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' INDEX_URL = reverse('horizon:project:images:index') CREATE_URL = reverse('horizon:project:images:images:create') @@ -53,7 +54,7 @@ class ImagesAndSnapshotsTests(test.TestCase): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/images/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertContains(res, 'help_text="Deleted images' ' are not recoverable."') self.assertIn('images_table', res.context) @@ -80,7 +81,7 @@ class ImagesAndSnapshotsTests(test.TestCase): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/images/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertContains(res, 'No items to display') @test.create_stubs({api.glance: ('image_list_detailed',)}) @@ -93,7 +94,7 @@ class ImagesAndSnapshotsTests(test.TestCase): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/images/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) @test.create_stubs({api.glance: ('image_list_detailed',)}) def test_snapshot_actions(self): @@ -106,7 +107,7 @@ class ImagesAndSnapshotsTests(test.TestCase): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/images/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertIn('images_table', res.context) snaps = res.context['images_table'] self.assertEqual(len(snaps.get_rows()), 3) diff --git a/openstack_dashboard/dashboards/project/images/views.py b/openstack_dashboard/dashboards/project/images/views.py index 621f6d9855..79bfde531b 100644 --- a/openstack_dashboard/dashboards/project/images/views.py +++ b/openstack_dashboard/dashboards/project/images/views.py @@ -36,7 +36,6 @@ from openstack_dashboard.dashboards.project.images.images \ class IndexView(tables.DataTableView): table_class = images_tables.ImagesTable - template_name = 'project/images/index.html' page_title = _("Images") def has_prev_data(self, table): diff --git a/openstack_dashboard/dashboards/project/instances/templates/instances/index.html b/openstack_dashboard/dashboards/project/instances/templates/instances/index.html deleted file mode 100644 index bec1e9bd42..0000000000 --- a/openstack_dashboard/dashboards/project/instances/templates/instances/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Instances" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index 11bb5fde46..38b6b54c11 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -47,6 +47,7 @@ from openstack_dashboard.test import helpers from openstack_dashboard.usage import quotas +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' INDEX_URL = reverse('horizon:project:instances:index') SEC_GROUP_ROLE_PREFIX = \ workflows.update_instance.INSTANCE_SEC_GROUP_SLUG + "_role_" @@ -157,8 +158,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase): res = self._get_index() - self.assertTemplateUsed(res, - 'project/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) instances = res.context['instances_table'].data self.assertItemsEqual(instances, self.servers.list()) @@ -185,7 +185,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase): res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertEqual(len(res.context['instances_table'].data), 0) self.assertMessageCount(res, error=1) @@ -228,7 +228,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase): res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) instances = res.context['instances_table'].data self.assertItemsEqual(instances, self.servers.list()) @@ -272,7 +272,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase): res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) instances = res.context['instances_table'].data self.assertEqual(len(instances), len(servers)) self.assertContains(res, "(not found)") @@ -4314,7 +4314,7 @@ class InstanceTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/instances/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) # get first page with 2 items self.assertEqual(len(res.context['instances_table'].data), page_size) diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index e9e8083b23..844d6075fa 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -57,7 +57,6 @@ LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): table_class = project_tables.InstancesTable - template_name = 'project/instances/index.html' page_title = _("Instances") def has_more_data(self, table): diff --git a/openstack_dashboard/dashboards/project/networks/templates/networks/index.html b/openstack_dashboard/dashboards/project/networks/templates/networks/index.html deleted file mode 100644 index 218caf9c6e..0000000000 --- a/openstack_dashboard/dashboards/project/networks/templates/networks/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Networks" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/networks/tests.py b/openstack_dashboard/dashboards/project/networks/tests.py index d74b2d6af2..659dc5d2b7 100644 --- a/openstack_dashboard/dashboards/project/networks/tests.py +++ b/openstack_dashboard/dashboards/project/networks/tests.py @@ -30,6 +30,7 @@ from openstack_dashboard.test import helpers as test from openstack_dashboard.usage import quotas +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' INDEX_URL = reverse('horizon:project:networks:index') @@ -137,7 +138,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/networks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) networks = res.context['networks_table'].data self.assertItemsEqual(networks, self.networks.list()) @@ -156,7 +157,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin): res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/networks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertEqual(len(res.context['networks_table'].data), 0) self.assertMessageCount(res, error=1) @@ -1212,7 +1213,7 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/networks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) networks = res.context['networks_table'].data self.assertItemsEqual(networks, self.networks.list()) @@ -1238,7 +1239,7 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin): self.mox.ReplayAll() res = self.client.get(INDEX_URL) - self.assertTemplateUsed(res, 'project/networks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) networks = res.context['networks_table'].data self.assertItemsEqual(networks, self.networks.list()) diff --git a/openstack_dashboard/dashboards/project/networks/views.py b/openstack_dashboard/dashboards/project/networks/views.py index 588d16d129..ea6356d142 100644 --- a/openstack_dashboard/dashboards/project/networks/views.py +++ b/openstack_dashboard/dashboards/project/networks/views.py @@ -42,7 +42,6 @@ from openstack_dashboard.dashboards.project.networks \ class IndexView(tables.DataTableView): table_class = project_tables.NetworksTable - template_name = 'project/networks/index.html' page_title = _("Networks") FILTERS_MAPPING = {'shared': {_("yes"): True, _("no"): False}, 'router:external': {_("yes"): True, _("no"): False}, diff --git a/openstack_dashboard/dashboards/project/routers/templates/routers/index.html b/openstack_dashboard/dashboards/project/routers/templates/routers/index.html deleted file mode 100644 index 88ed3111c9..0000000000 --- a/openstack_dashboard/dashboards/project/routers/templates/routers/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Routers" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/routers/tests.py b/openstack_dashboard/dashboards/project/routers/tests.py index 3f7d7c2926..dc4502d01e 100644 --- a/openstack_dashboard/dashboards/project/routers/tests.py +++ b/openstack_dashboard/dashboards/project/routers/tests.py @@ -25,6 +25,8 @@ from openstack_dashboard import api from openstack_dashboard.test import helpers as test from openstack_dashboard.usage import quotas +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' + class RouterMixin(object): @test.create_stubs({ @@ -98,7 +100,7 @@ class RouterTests(RouterMixin, test.TestCase): res = self.client.get(self.INDEX_URL) - self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD) + self.assertTemplateUsed(res, INDEX_TEMPLATE) routers = res.context['table'].data self.assertItemsEqual(routers, self.routers.list()) @@ -118,7 +120,7 @@ class RouterTests(RouterMixin, test.TestCase): res = self.client.get(self.INDEX_URL) - self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD) + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertEqual(len(res.context['table'].data), 0) self.assertMessageCount(res, error=1) @@ -142,7 +144,7 @@ class RouterTests(RouterMixin, test.TestCase): self.assertEqual(len(table_data), 1) self.assertIn('(Not Found)', table_data[0]['external_gateway_info']['network']) - self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD) + self.assertTemplateUsed(res, INDEX_TEMPLATE) self.assertMessageCount(res, error=1) def test_router_detail(self): @@ -806,7 +808,7 @@ class RouterViewTests(RouterMixin, test.TestCase): self.mox.ReplayAll() res = self.client.get(self.INDEX_URL) - self.assertTemplateUsed(res, 'project/routers/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) routers = res.context['routers_table'].data self.assertItemsEqual(routers, self.routers.list()) @@ -833,7 +835,7 @@ class RouterViewTests(RouterMixin, test.TestCase): self.mox.ReplayAll() res = self.client.get(self.INDEX_URL) - self.assertTemplateUsed(res, 'project/routers/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) routers = res.context['routers_table'].data self.assertItemsEqual(routers, self.routers.list()) @@ -860,7 +862,7 @@ class RouterViewTests(RouterMixin, test.TestCase): self.mox.ReplayAll() res = self.client.get(self.INDEX_URL) - self.assertTemplateUsed(res, 'project/routers/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) routers = res.context['routers_table'].data self.assertItemsEqual(routers, self.routers.list()) diff --git a/openstack_dashboard/dashboards/project/routers/views.py b/openstack_dashboard/dashboards/project/routers/views.py index d6806e20ed..3e06624cf7 100644 --- a/openstack_dashboard/dashboards/project/routers/views.py +++ b/openstack_dashboard/dashboards/project/routers/views.py @@ -42,7 +42,6 @@ from openstack_dashboard.dashboards.project.routers import tabs as rdtabs class IndexView(tables.DataTableView): table_class = rtables.RoutersTable - template_name = 'project/routers/index.html' page_title = _("Routers") FILTERS_MAPPING = {'admin_state_up': {_("up"): True, _("down"): False}} diff --git a/openstack_dashboard/dashboards/project/stacks/resource_types/templates/stacks.resource_types/index.html b/openstack_dashboard/dashboards/project/stacks/resource_types/templates/stacks.resource_types/index.html deleted file mode 100644 index 1c98250c30..0000000000 --- a/openstack_dashboard/dashboards/project/stacks/resource_types/templates/stacks.resource_types/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Resource Types" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/stacks/resource_types/tests.py b/openstack_dashboard/dashboards/project/stacks/resource_types/tests.py index d9dd2d1b2d..d634ab2310 100644 --- a/openstack_dashboard/dashboards/project/stacks/resource_types/tests.py +++ b/openstack_dashboard/dashboards/project/stacks/resource_types/tests.py @@ -33,7 +33,7 @@ class ResourceTypesTests(test.TestCase): res = self.client.get( reverse('horizon:project:stacks.resource_types:index')) self.assertTemplateUsed( - res, 'project/stacks.resource_types/index.html') + res, 'horizon/common/_data_table_view.html') self.assertContains(res, 'AWS::CloudFormation::Stack') @test.create_stubs({api.heat: ('resource_type_get',)}) diff --git a/openstack_dashboard/dashboards/project/stacks/resource_types/views.py b/openstack_dashboard/dashboards/project/stacks/resource_types/views.py index a777db6297..8afcdf830d 100644 --- a/openstack_dashboard/dashboards/project/stacks/resource_types/views.py +++ b/openstack_dashboard/dashboards/project/stacks/resource_types/views.py @@ -29,7 +29,6 @@ import openstack_dashboard.dashboards.project.stacks.resource_types.tabs \ class ResourceTypesView(tables.DataTableView): table_class = project_tables.ResourceTypesTable - template_name = 'project/stacks.resource_types/index.html' page_title = _("Resource Types") def get_data(self): diff --git a/openstack_dashboard/dashboards/project/stacks/templates/stacks/index.html b/openstack_dashboard/dashboards/project/stacks/templates/stacks/index.html deleted file mode 100644 index 85e8bd925a..0000000000 --- a/openstack_dashboard/dashboards/project/stacks/templates/stacks/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% block title %}{% trans "Stacks" %}{% endblock %} - -{% block main %} - {{ table.render }} -{% endblock %} diff --git a/openstack_dashboard/dashboards/project/stacks/tests.py b/openstack_dashboard/dashboards/project/stacks/tests.py index cb8e687035..4f0675ed81 100644 --- a/openstack_dashboard/dashboards/project/stacks/tests.py +++ b/openstack_dashboard/dashboards/project/stacks/tests.py @@ -34,6 +34,7 @@ from openstack_dashboard.dashboards.project.stacks import mappings from openstack_dashboard.dashboards.project.stacks import tables +INDEX_TEMPLATE = 'horizon/common/_data_table_view.html' INDEX_URL = reverse('horizon:project:stacks:index') DETAIL_URL = 'horizon:project:stacks:detail' @@ -153,7 +154,7 @@ class StackTests(test.TestCase): # get all self.assertEqual(len(res.context['stacks_table'].data), len(stacks)) - self.assertTemplateUsed(res, 'project/stacks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) res = self.client.get(url) # get first page with 2 items @@ -212,7 +213,7 @@ class StackTests(test.TestCase): # get all self.assertEqual(len(res.context['stacks_table'].data), len(stacks)) - self.assertTemplateUsed(res, 'project/stacks/index.html') + self.assertTemplateUsed(res, INDEX_TEMPLATE) res = self.client.get(url) # get first page with 2 items diff --git a/openstack_dashboard/dashboards/project/stacks/views.py b/openstack_dashboard/dashboards/project/stacks/views.py index 3108f79d9e..e1480c956d 100644 --- a/openstack_dashboard/dashboards/project/stacks/views.py +++ b/openstack_dashboard/dashboards/project/stacks/views.py @@ -40,7 +40,6 @@ from openstack_dashboard.dashboards.project.stacks \ class IndexView(tables.DataTableView): table_class = project_tables.StacksTable - template_name = 'project/stacks/index.html' page_title = _("Stacks") def __init__(self, *args, **kwargs):