remove the BackupDetailTable

This commit is contained in:
Andreas Zweili 2019-12-29 13:50:51 +01:00
parent 14865608ee
commit bc9afcd0c6
3 changed files with 41 additions and 16 deletions

View File

@ -63,11 +63,3 @@ class NetDetailTable(tables.Table):
class Meta:
template_name = 'django_tables2/semantic.html'
model = DeviceInNet
class BackupDetailTable(tables.Table):
computer = tables.Column('computer', linkify=True)
class Meta:
template_name = 'django_tables2/semantic.html'
model = Backup

View File

@ -1,6 +1,39 @@
{% extends "inventory/base.html" %}
{% load render_table from django_tables2 %}
{% block section_title %}{{ net.name }}{% endblock %}
{% block section_title %}{{ backup.name }}{% endblock %}
{% block content %}
{% render_table backup %}
<div class="ui cards">
<div class="card">
<div class="content">
<div class="header">Description</div>
<div class="description"><p>{{ backup.description }}</p></div>
<table class="ui celled table">
</tr>
<tr>
<th><b>Computer:</b></th>
<td><a href="{% url 'computer' backup.computer.id %}">{{ backup.computer }}</a></td>
</tr>
<tr>
<th><b>Backup Method:</b></th>
<td>{{ backup.method }}</td>
</tr>
<tr>
<th><b>Backup Software:</b></th>
<td>{{ backup.software }}</td>
</tr>
<tr>
<th><b>Target Device:</b></th>
<td>{{ backup.target_device.device }}</td>
</tr>
<tr>
<th><b>Exec Time:</b></th>
<td>{{ backup.exec_time }}</td>
</tr>
<tr>
<th><b>Exec Day:</b></th>
<td>{{ backup.exec_day }}</td>
</tr>
</table>
</div>
</div>
</div>
{% endblock %}

View File

@ -12,13 +12,14 @@ from django_tables2.views import SingleTableMixin
from django_filters.views import FilterView
from .decorators import (computer_view_permission, customer_view_permission,
net_view_permission, device_view_permission)
net_view_permission, device_view_permission,
backup_view_permission)
from .models import (Device, Computer, ComputerRamRelation,
ComputerDiskRelation, ComputerCpuRelation,
ComputerSoftwareRelation, Customer, Net, Raid,
Backup, DeviceInNet)
from .tables import (CustomersTable, ComputersTable, DevicesTable, NetsTable,
BackupsTable, NetDetailTable, BackupDetailTable)
BackupsTable, NetDetailTable)
from .filters import ComputerFilter
@ -113,9 +114,8 @@ def backups_table_view(request, pk):
@login_required
def backup_detail_view(request, pk):
table = BackupDetailTable(Backup.objects.filter(pk=pk))
RequestConfig(request).configure(table)
return render(request, 'inventory/backup_details.html', {'backup': table})
backup = get_object_or_404(Backup, pk=pk)
return render(request, 'inventory/backup_details.html', {'backup': backup})
class ComputersFilterView(LoginRequiredMixin, SingleTableMixin, FilterView):