Added DeviceInfos in device detail view

pull/78/head
Konstantin Gründger 2019-04-03 22:35:33 +02:00
rodzic 5f50d33cdf
commit 6ff07a7ba0
2 zmienionych plików z 31 dodań i 1 usunięć

Wyświetl plik

@ -39,6 +39,14 @@ class Device(db.Model):
return query.first() return query.first()
# Todo: remove FK from DeviceInfo
def get_infos(self):
query = db.session.query(DeviceInfo) \
.filter(DeviceInfo.address == self.address) \
.order_by(DeviceInfo.address_origin)
return [info for info in query.all()]
EXPIRY_DATES = { EXPIRY_DATES = {
6.67: datetime.date(2020, 10, 31), 6.67: datetime.date(2020, 10, 31),
6.63: datetime.date(2020, 5, 31), 6.63: datetime.date(2020, 5, 31),

Wyświetl plik

@ -19,6 +19,28 @@
</table> </table>
</div> </div>
<div class="panel panel-success">
<div class="panel-heading"><h3 class="panel-title">Device Info</h3></div>
<table class="datatable table table-striped table-bordered">
<tr>
<th>Aircraft</th>
<th>Registration</th>
<th>Competition Sign</th>
<th>Aircraft Type</th>
<th>Source</th>
</tr>
<tr>
{% for info in device.get_infos() %}
<td>{{ info.aircraft }}</td>
<td>{{ info.registration }}</td>
<td>{{ info.competition }}</td>
<td>{{ info.aircraft_type }}</td>
<td>{{ info.address_origin }}</td>
{% endfor %}
</tr>
</table>
</div> </div>
{% endblock %} </div>
{% endblock %}