Skip to content

Commit

Permalink
Speed up observations page
Browse files Browse the repository at this point in the history
  • Loading branch information
eheinrich committed Jul 19, 2019
1 parent eae3086 commit 572e116
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
{% bootstrap_pagination page_obj extra=request.GET.urlencode %}
</span>
{% endif %}
{% with last_update=filter.qs.first.modified %}
<span class="float-right text-right">
{{ filter.qs.count }} observations<br/>
Last Update: <strong>{{ filter.qs.first.modified }}</strong>
{{ page_obj.paginator.count }} observations<br/>
Last Update: <strong>{{ last_update }}</strong>
</span>
<table class="table">
<thead>
Expand Down Expand Up @@ -66,9 +67,10 @@
</span>
{% endif %}
<span class="float-right text-right">
Last Update: <strong>{{ filter.qs.first.modified }}</strong><br/>
{{ filter.qs.count }} observations
Last Update: <strong>{{ last_update }}</strong><br/>
{{ page_obj.paginator.count }} observations
</span>
{% endwith %}
</div>
<div class="col-md-2">
<form class="form" method="GET" action="{% url 'observations:observation-list' %}">
Expand Down
2 changes: 2 additions & 0 deletions observation_portal/observations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from observation_portal.common.mixins import StaffRequiredMixin
from observation_portal.common.configdb import configdb
from observation_portal.observations.filters import ObservationFilter
from observation_portal.observations.viewsets import observations_queryset


class ObservationDetailView(StaffRequiredMixin, DetailView):
Expand All @@ -23,6 +24,7 @@ class ObservationListView(StaffRequiredMixin, FilterView):
paginate_by = 50
ordering = '-start'
template_name = 'observations/observation_list.html'
queryset = observations_queryset()

def get_filterset_kwargs(self, filterset_class):
kwargs = super(ObservationListView, self).get_filterset_kwargs(filterset_class)
Expand Down

0 comments on commit 572e116

Please sign in to comment.