reformat the computer list to a table instead of a list

This commit is contained in:
Andreas Zweili 2017-12-25 23:55:07 +01:00
parent 5f00b2de26
commit ffa545110b
2 changed files with 28 additions and 10 deletions

View File

@ -539,16 +539,25 @@ information.
{% extends "inventory/base.html" %} {% extends "inventory/base.html" %}
{% block content %} {% block content %}
{% if device_list or computer_list %} {% if device_list or computer_list %}
<h3>Device List</h3>
<ul> <ul>
{% for device in device_list %} {% for device in device_list %}
<li><a href="{% url 'device' device.id %}">{{ device.name }}</a></li> <li><a href="{% url 'device' device.id %}">{{ device.name }}</a></li>
{% endfor %} {% endfor %}
{% for computer in computer_list %}
<li><a href="{% url 'computer' computer.id %}">{{ computer.name }}</a></li>
{% endfor %}
</ul> </ul>
{% else %} <h3>Computer List</h3>
<p>No devices are available.</p> <table>
<tr>
<th>Hostname</th>
<th>IP</th>
</tr>
{% for computer in computer_list %}
<tr>
<td><a href="{% url 'computer' computer.id %}">{{ computer.name }}</a></td>
<td>{{ computer.ip }}</td>
</tr>
{% endfor %}
</table>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
#+END_SRC #+END_SRC

View File

@ -1,15 +1,24 @@
{% extends "inventory/base.html" %} {% extends "inventory/base.html" %}
{% block content %} {% block content %}
{% if device_list or computer_list %} {% if device_list or computer_list %}
<h3>Device List</h3>
<ul> <ul>
{% for device in device_list %} {% for device in device_list %}
<li><a href="{% url 'device' device.id %}">{{ device.name }}</a></li> <li><a href="{% url 'device' device.id %}">{{ device.name }}</a></li>
{% endfor %} {% endfor %}
{% for computer in computer_list %}
<li><a href="{% url 'computer' computer.id %}">{{ computer.name }}</a></li>
{% endfor %}
</ul> </ul>
{% else %} <h3>Computer List</h3>
<p>No devices are available.</p> <table>
<tr>
<th>Hostname</th>
<th>IP</th>
</tr>
{% for computer in computer_list %}
<tr>
<td><a href="{% url 'computer' computer.id %}">{{ computer.name }}</a></td>
<td>{{ computer.ip }}</td>
</tr>
{% endfor %}
</table>
{% endif %} {% endif %}
{% endblock %} {% endblock %}