add a table which lists all the cron jobs

This commit is contained in:
Andreas Zweili 2017-12-26 11:36:28 +01:00
parent afb2d0ed95
commit 4a21cc6ad3
3 changed files with 52 additions and 2 deletions

View File

@ -410,11 +410,13 @@ from .models import (GeneralDevice, Computer, CronJob,
def index(request):
device_list = GeneralDevice.objects.all()
computer_list = Computer.objects.all().order_by('ip')
cronjob_list = CronJob.objects.all().order_by('host')
return render(request,
'inventory/index.html',
{'device_list': device_list,
'computer_list': computer_list})
'computer_list': computer_list,
'cronjob_list': cronjob_list})
def device_details(request, device_id):
@ -564,6 +566,29 @@ information.
{% endfor %}
</table>
{% endif %}
{% if cronjob_list %}
<h3>Cron Job List</h3>
<table cellpadding="10">
<tr>
<th>Name</th>
<th>Hostname</th>
<th>Time</th>
<th>Day of Week</th>
<th>Day of Month</th>
<th>Month</th>
</tr>
{% for cronjob in cronjob_list %}
<tr>
<td><a href="{% url 'cronjob' cronjob.id %}">{{ cronjob.name }}</a></td>
<td>{{ cronjob.host }}</td>
<td>{{ cronjob.time }}</td>
<td>{{ cronjob.weekday }}</td>
<td>{{ cronjob.day }}</td>
<td>{{ cronjob.month }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}
#+END_SRC

View File

@ -21,4 +21,27 @@
{% endfor %}
</table>
{% endif %}
{% if cronjob_list %}
<h3>Cron Job List</h3>
<table cellpadding="10">
<tr>
<th>Name</th>
<th>Hostname</th>
<th>Time</th>
<th>Day of Week</th>
<th>Day of Month</th>
<th>Month</th>
</tr>
{% for cronjob in cronjob_list %}
<tr>
<td><a href="{% url 'cronjob' cronjob.id %}">{{ cronjob.name }}</a></td>
<td>{{ cronjob.host }}</td>
<td>{{ cronjob.time }}</td>
<td>{{ cronjob.weekday }}</td>
<td>{{ cronjob.day }}</td>
<td>{{ cronjob.month }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}

View File

@ -9,11 +9,13 @@ from .models import (GeneralDevice, Computer, CronJob,
def index(request):
device_list = GeneralDevice.objects.all()
computer_list = Computer.objects.all().order_by('ip')
cronjob_list = CronJob.objects.all().order_by('host')
return render(request,
'inventory/index.html',
{'device_list': device_list,
'computer_list': computer_list})
'computer_list': computer_list,
'cronjob_list': cronjob_list})
def device_details(request, device_id):