
This patch removes logging import unused in disaster_recovery Change-Id: I453254206e4c91f005018cad9eff512a85a40df0
46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import pprint
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
from django.views import generic
|
|
|
|
from horizon import tables
|
|
|
|
import disaster_recovery.api.api as freezer_api
|
|
|
|
from disaster_recovery.clients import tables as freezer_tables
|
|
from disaster_recovery.utils import shield
|
|
|
|
|
|
class IndexView(tables.DataTableView):
|
|
name = _("Clients")
|
|
slug = "clients"
|
|
table_class = freezer_tables.ClientsTable
|
|
template_name = "disaster_recovery/clients/index.html"
|
|
|
|
@shield('Unable to get clients', redirect='clients:index')
|
|
def get_data(self):
|
|
filters = self.table.get_filter_string() or None
|
|
return freezer_api.Client(self.request).list(search=filters)
|
|
|
|
|
|
class ClientView(generic.TemplateView):
|
|
template_name = 'disaster_recovery/clients/detail.html'
|
|
|
|
@shield('Unable to get client', redirect='clients:index')
|
|
def get_context_data(self, **kwargs):
|
|
client = freezer_api.Client(self.request).get(kwargs['client_id'],
|
|
json=True)
|
|
return {'data': pprint.pformat(client)}
|