Add future tag and beautify observations filtering
parent
7a01c9b1bd
commit
cceeeb697e
|
@ -133,6 +133,7 @@ class ObservationListView(ListView):
|
|||
norad_cat_id = self.request.GET.get('norad', '')
|
||||
observer = self.request.GET.get('observer', '')
|
||||
station = self.request.GET.get('station', '')
|
||||
|
||||
bad = self.request.GET.get('bad', '1')
|
||||
if bad == '0':
|
||||
bad = False
|
||||
|
@ -148,6 +149,11 @@ class ObservationListView(ListView):
|
|||
unvetted = False
|
||||
else:
|
||||
unvetted = True
|
||||
future = self.request.GET.get('future', '1')
|
||||
if future == '0':
|
||||
future = False
|
||||
else:
|
||||
future = True
|
||||
|
||||
observations = Observation.objects.all()
|
||||
if not norad_cat_id == '':
|
||||
|
@ -165,7 +171,12 @@ class ObservationListView(ListView):
|
|||
if not good:
|
||||
observations = observations.exclude(vetted_status='verified')
|
||||
if not unvetted:
|
||||
observations = observations.exclude(vetted_status='unknown')
|
||||
observations = observations.exclude(vetted_status='unknown',
|
||||
id__in=[o.id for
|
||||
o in observations if o.end < now()])
|
||||
if not future:
|
||||
observations = observations.exclude(id__in=[o.id for
|
||||
o in observations if o.end > now()])
|
||||
return observations
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
@ -179,6 +190,7 @@ class ObservationListView(ListView):
|
|||
norad_cat_id = self.request.GET.get('norad', None)
|
||||
observer = self.request.GET.get('observer', None)
|
||||
station = self.request.GET.get('station', None)
|
||||
context['future'] = self.request.GET.get('future', '1')
|
||||
context['bad'] = self.request.GET.get('bad', '1')
|
||||
context['good'] = self.request.GET.get('good', '1')
|
||||
context['unvetted'] = self.request.GET.get('unvetted', '1')
|
||||
|
|
|
@ -392,9 +392,8 @@ span.datetime-time {
|
|||
padding: 15px;
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
#data-selector {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#collapseFilters h4,
|
||||
|
|
|
@ -27,15 +27,18 @@
|
|||
<div class="form-group col-md-3">
|
||||
<label for="data-selector">Data</label>
|
||||
<div id="data-selector" class="btn-group" data-toggle="buttons">
|
||||
<label class="btn btn-default btn-sm {% if bad == '1' %}active{% endif %}" aria-expanded="true" aria-controls="bad">
|
||||
<label class="btn btn-info btn-sm {% if future == '1' %}active{% endif %}" aria-expanded="true" aria-controls="future">
|
||||
<input type="checkbox" name="future" {% if future == '1' %}checked{% endif %} autocomplete="off">Future
|
||||
</label>
|
||||
<label class="btn btn-success btn-sm {% if good == '1' %}active{% endif %}" aria-expanded="true" aria-controls="good">
|
||||
<input type="checkbox" name="good" {% if good == '1' %}checked{% endif %} autocomplete="off">Good
|
||||
</label>
|
||||
<label class="btn btn-danger btn-sm {% if bad == '1' %}active{% endif %}" aria-expanded="true" aria-controls="bad">
|
||||
<input type="checkbox" name="bad" {% if bad == '1' %}checked{% endif %} autocomplete="off">Bad
|
||||
</label>
|
||||
<label class="btn btn-default btn-sm {% if unvetted == '1' %}active{% endif %}" aria-expanded="true" aria-controls="unvetted">
|
||||
<label class="btn btn-warning btn-sm {% if unvetted == '1' %}active{% endif %}" aria-expanded="true" aria-controls="unvetted">
|
||||
<input type="checkbox" name="unvetted" {% if unvetted == '1' %}checked{% endif %} autocomplete="off">Unvetted
|
||||
</label>
|
||||
<label class="btn btn-default btn-sm {% if good == '1' %}active{% endif %}" aria-expanded="true" aria-controls="good">
|
||||
<input type="checkbox" name="good" {% if good == '1' %}checked{% endif %} autocomplete="off">Good
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
|
|
Loading…
Reference in New Issue