Merge pull request #38 from satnogs/37-observations-page
Create dynamic observations page.merge-requests/43/head
commit
ea37749994
|
@ -22,6 +22,13 @@ def index(request):
|
|||
return render(request, 'base/home.html', ctx)
|
||||
|
||||
|
||||
def observations_list(request):
|
||||
"""View to render Observations page."""
|
||||
observations = Observation.objects.all()
|
||||
|
||||
return render(request, 'base/observations.html', {'observations': observations})
|
||||
|
||||
|
||||
def stations_json(request):
|
||||
data = serializers.serialize('json', Station.objects.all())
|
||||
|
||||
|
|
|
@ -1,5 +1,43 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Observations{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Observations</h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
<th>Satellite</th>
|
||||
<th>Frequency</th>
|
||||
<th>Encoding</th>
|
||||
<th>Timeframe</th>
|
||||
<th>Observer</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for observation in observations.all %}
|
||||
<tr>
|
||||
<td>
|
||||
<span class="label
|
||||
{% if not observation.data_set.all %}
|
||||
label-danger
|
||||
{% else %}
|
||||
label-success
|
||||
{% endif %}">
|
||||
{{ observation.id }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ observation.satellite.name }}</td>
|
||||
<td>{{ observation.transponder.downlink_low }}</td>
|
||||
<td>{{ observation.transponder.mode }}</td>
|
||||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>{{ observation.author.get_full_name }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
|
@ -13,13 +13,11 @@ urlpatterns = patterns(
|
|||
'',
|
||||
url(r'^$', 'base.views.index', name='home'),
|
||||
url(r'^stations/json/$', 'base.views.stations_json', name='stations_json'),
|
||||
url(r'^observations/$', 'base.views.observations_list', name='observations'),
|
||||
|
||||
url(r'^about/$',
|
||||
TemplateView.as_view(template_name='base/about.html'),
|
||||
name='about'),
|
||||
url(r'^observations/$',
|
||||
TemplateView.as_view(template_name='base/observations.html'),
|
||||
name='observations'),
|
||||
url(r'^stations/$',
|
||||
TemplateView.as_view(template_name='base/stations.html'),
|
||||
name='stations'),
|
||||
|
|
Loading…
Reference in New Issue