update the net_detail_view to display the NetDetailTable correctly

This commit is contained in:
Andreas Zweili 2019-09-01 12:18:46 +02:00
parent d0e71ad7fb
commit 2d06992811
2 changed files with 9 additions and 3 deletions

View File

@ -2,5 +2,8 @@
{% load render_table from django_tables2 %}
{% block section_title %}{{ net.name }}{% endblock %}
{% block content %}
{% render_table net %}
{% if net.description %}
<p>{{ net.description }}</p>
{% endif %}
{% render_table table %}
{% endblock %}

View File

@ -88,9 +88,12 @@ def nets_table_view(request, customer_id):
@login_required
def net_detail_view(request, pk):
table = NetDetailTable(Net.objects.filter(pk=pk))
net = get_object_or_404(Net, pk=pk)
table = NetDetailTable(DeviceInNet.objects.filter(net=net))
RequestConfig(request).configure(table)
return render(request, 'inventory/net_details.html', {'net': table})
return render(request, 'inventory/net_details.html',
{'table': table,
'net': net})
@login_required