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: class Meta:
template_name = 'django_tables2/semantic.html' template_name = 'django_tables2/semantic.html'
model = DeviceInNet 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" %} {% extends "inventory/base.html" %}
{% load render_table from django_tables2 %} {% block section_title %}{{ backup.name }}{% endblock %}
{% block section_title %}{{ net.name }}{% endblock %}
{% block content %} {% 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 %} {% endblock %}

View File

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