sistemas por cliente devices
This commit is contained in:
@@ -148,9 +148,11 @@ class UsersConnectedList(UserPassesTestMixin,LoginRequiredMixin,ListView):
|
||||
return users
|
||||
|
||||
class SistemasXCliente_ListView(UserPassesTestMixin,LoginRequiredMixin, ListView):
|
||||
|
||||
model = sistemas_por_cliente
|
||||
paginate_by = 5
|
||||
paginate_by = 20
|
||||
template_name = 'Sistemas/Xclientes/lista.html'
|
||||
|
||||
def test_func(self):
|
||||
res = self.request.user.groups.filter(name= 'admin_soft')
|
||||
if not res:
|
||||
@@ -165,6 +167,15 @@ class SistemasXCliente_DetailView(UserPassesTestMixin,LoginRequiredMixin, Detail
|
||||
if not res:
|
||||
messages.error(self.request, f'Lo sentimos. La página que buscas no está disponible, no cuentas con los permisos.')
|
||||
return res
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
sistemas_por_cliente = self.object
|
||||
sistema = sistemas_por_cliente.id_sistema
|
||||
cliente = sistemas_por_cliente.cliente
|
||||
print(sistema.id, cliente.id)
|
||||
context['devices'] = Device.objects.filter(sistema=sistema, client=cliente.id)
|
||||
return context
|
||||
|
||||
|
||||
class SistemasxCliente_CreateView(CreateView):
|
||||
|
||||
Reference in New Issue
Block a user