Merge branch 'performance-improvements' into 'master'
Performance improvements in user and station page See merge request librespacefoundation/satnogs/satnogs-network!795merge-requests/795/merge
commit
933478f43b
|
@ -117,20 +117,22 @@
|
|||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if station.observations_count %}
|
||||
<div class="front-line">
|
||||
<span class="label label-default">Observations</span>
|
||||
<span class="front-data">{{ station.observations_count }}
|
||||
<div class="pull-right">
|
||||
<a href="{% url 'base:observations_list' %}?station={{ station.id }}">
|
||||
<button type="button" class="btn btn-xs btn-info">
|
||||
View all
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% with total_obs=station.observations_count %}
|
||||
{% if total_obs %}
|
||||
<div class="front-line">
|
||||
<span class="label label-default">Observations</span>
|
||||
<span class="front-data">{{ total_obs }}
|
||||
<div class="pull-right">
|
||||
<a href="{% url 'base:observations_list' %}?station={{ station.id }}">
|
||||
<button type="button" class="btn btn-xs btn-info">
|
||||
View all
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<div class="front-line">
|
||||
<span class="label label-default">Creation Date</span>
|
||||
<span class="front-data"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<th>Antennas</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for station in stations.all %}
|
||||
{% for station in stations %}
|
||||
<tr class="clickable-row" data-href="{% url 'base:station_view' station_id=station.id %}">
|
||||
<td>
|
||||
<a href="{% url 'base:station_view' station_id=station.id %}">
|
||||
|
@ -145,7 +145,7 @@
|
|||
<th>Station</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for observation in observations.all %}
|
||||
{% for observation in observations %}
|
||||
<tr class="clickable-row" data-href="{% url 'base:observation_view' observation_id=observation.id %}">
|
||||
<td>
|
||||
<a href="{% url 'base:observation_view' observation_id=observation.id %}">
|
||||
|
|
|
@ -37,7 +37,9 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
|
|||
def view_user(request, username):
|
||||
"""View for user page."""
|
||||
user = get_object_or_404(User, username=username)
|
||||
observations = Observation.objects.filter(author=user)[0:10]
|
||||
observations = Observation.objects.filter(
|
||||
author=user
|
||||
)[0:10].prefetch_related('satellite', 'ground_station')
|
||||
stations = Station.objects.filter(owner=user).annotate(total_obs=Count('observations'))
|
||||
token = ''
|
||||
|
||||
|
|
Loading…
Reference in New Issue