1
0
Fork 0

Improve performance in home view by reducing sql queries

Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
spacecruft
Alfredos-Panagiotis Damkalis 2021-07-21 21:30:08 +03:00
parent 3391fa8604
commit e7b0e56a17
1 changed files with 2 additions and 1 deletions

View File

@ -51,7 +51,8 @@ def home(request):
latest_data_satellites = []
found = False
date_from = now() - timedelta(days=1)
data_list = DemodData.objects.filter(timestamp__gte=date_from).order_by('-pk')
data_list = DemodData.objects.filter(timestamp__gte=date_from
).order_by('-pk').select_related('satellite')
paginator = Paginator(data_list, 50)
page = paginator.page(1)
while not found: