sistemas por cliente devices
This commit is contained in:
@@ -148,9 +148,11 @@ class UsersConnectedList(UserPassesTestMixin,LoginRequiredMixin,ListView):
|
|||||||
return users
|
return users
|
||||||
|
|
||||||
class SistemasXCliente_ListView(UserPassesTestMixin,LoginRequiredMixin, ListView):
|
class SistemasXCliente_ListView(UserPassesTestMixin,LoginRequiredMixin, ListView):
|
||||||
|
|
||||||
model = sistemas_por_cliente
|
model = sistemas_por_cliente
|
||||||
paginate_by = 5
|
paginate_by = 20
|
||||||
template_name = 'Sistemas/Xclientes/lista.html'
|
template_name = 'Sistemas/Xclientes/lista.html'
|
||||||
|
|
||||||
def test_func(self):
|
def test_func(self):
|
||||||
res = self.request.user.groups.filter(name= 'admin_soft')
|
res = self.request.user.groups.filter(name= 'admin_soft')
|
||||||
if not res:
|
if not res:
|
||||||
@@ -165,6 +167,15 @@ class SistemasXCliente_DetailView(UserPassesTestMixin,LoginRequiredMixin, Detail
|
|||||||
if not res:
|
if not res:
|
||||||
messages.error(self.request, f'Lo sentimos. La página que buscas no está disponible, no cuentas con los permisos.')
|
messages.error(self.request, f'Lo sentimos. La página que buscas no está disponible, no cuentas con los permisos.')
|
||||||
return res
|
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):
|
class SistemasxCliente_CreateView(CreateView):
|
||||||
|
|||||||
@@ -26,44 +26,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if page_obj.has_other_pages %}
|
|
||||||
|
|
||||||
<nav>
|
|
||||||
<ul class="pagination justify-content-center">
|
|
||||||
{% if page_obj.has_previous %}
|
|
||||||
<li class="page-item">
|
|
||||||
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" aria-label="Previous">
|
|
||||||
<span aria-hidden="true">«</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item disabled">
|
|
||||||
<span class="page-link" aria-hidden="true">«</span>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% for p in page_obj.paginator.page_range %}
|
|
||||||
{% if page_obj.number == p %}
|
|
||||||
<li class="page-item"><a class="page-link" style="color: red;" href="#">{{ p }}</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item"><a class="page-link" href="?page={{ p }}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}">{{ p }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% if page_obj.has_next %}
|
|
||||||
<li class="page-item">
|
|
||||||
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" aria-label="Next">
|
|
||||||
<span aria-hidden="true">»</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item disabled">
|
|
||||||
<span class="page-link" aria-hidden="true">»</span>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
@@ -72,16 +72,16 @@ thead {
|
|||||||
<td>-</td>
|
<td>-</td>
|
||||||
<td>click me</td>
|
<td>click me</td>
|
||||||
<td class="table-elipse" data-toggle="collapse" data-target="#demo"><i class="fa fa-ellipsis-h text-black-50"></i></td>
|
<td class="table-elipse" data-toggle="collapse" data-target="#demo"><i class="fa fa-ellipsis-h text-black-50"></i></td>
|
||||||
|
</tr>
|
||||||
|
{% for device in devices %}
|
||||||
|
<tr id="demo" class="collapse cell-1 row-child">
|
||||||
|
<td class="text-center" colspan="1"><i class="fa fa-angle-up"></i></td>
|
||||||
|
<td colspan="1">Dispositivo: <strong>{{ device }}</strong> </td>
|
||||||
|
<td colspan="3"></td>
|
||||||
|
<td colspan="1">-</td>
|
||||||
|
<td colspan="2">-</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% for sistema in object.id_sistema.device_set.all %}
|
{% endfor %}
|
||||||
<tr id="demo" class="collapse cell-1 row-child">
|
|
||||||
<td class="text-center" colspan="1"><i class="fa fa-angle-up"></i></td>
|
|
||||||
<td colspan="1">Dispositivo: <strong>{{sistema}}</strong> </td>
|
|
||||||
<td colspan="3"></td>
|
|
||||||
<td colspan="1">-</td>
|
|
||||||
<td colspan="2">-</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,6 +31,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
@@ -1,4 +1,46 @@
|
|||||||
|
|
||||||
|
{% if page_obj.has_other_pages %}
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination justify-content-center">
|
||||||
|
{% if page_obj.has_previous %}
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" aria-label="Previous">
|
||||||
|
<span aria-hidden="true">«</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="page-item disabled">
|
||||||
|
<span class="page-link" aria-hidden="true">«</span>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for p in page_obj.paginator.page_range %}
|
||||||
|
{% if page_obj.number == p %}
|
||||||
|
<li class="page-item"><a class="page-link" style="color: red;" href="#">{{ p }}</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li class="page-item"><a class="page-link" href="?page={{ p }}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}">{{ p }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if page_obj.has_next %}
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" aria-label="Next">
|
||||||
|
<span aria-hidden="true">»</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="page-item disabled">
|
||||||
|
<span class="page-link" aria-hidden="true">»</span>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if lista.has_other_pages %}
|
{% if lista.has_other_pages %}
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
|
|||||||
Reference in New Issue
Block a user