kopia lustrzana https://github.com/glidernet/ogn-python
Added DeviceInfos in device detail view
rodzic
5f50d33cdf
commit
6ff07a7ba0
|
@ -39,6 +39,14 @@ class Device(db.Model):
|
|||
|
||||
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 = {
|
||||
6.67: datetime.date(2020, 10, 31),
|
||||
6.63: datetime.date(2020, 5, 31),
|
||||
|
|
|
@ -19,6 +19,28 @@
|
|||
</table>
|
||||
</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>
|
||||
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
Ładowanie…
Reference in New Issue