Extend session search
This commit is contained in:
parent
832bb48983
commit
2d3ea714c4
|
@ -2,6 +2,7 @@ from typing import Any
|
|||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.paginator import Paginator
|
||||
from django.db.models import Q
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.template.loader import render_to_string
|
||||
|
@ -39,7 +40,13 @@ def list_sessions(request: HttpRequest, search_string: str = "") -> HttpResponse
|
|||
sessions = Session.objects.order_by("-timestamp_start")
|
||||
search_string = request.GET.get("search_string", search_string)
|
||||
if search_string != "":
|
||||
sessions = sessions.filter(purchase__edition__name__icontains=search_string)
|
||||
sessions = sessions.filter(
|
||||
Q(purchase__edition__name__icontains=search_string)
|
||||
| Q(purchase__edition__game__name__icontains=search_string)
|
||||
| Q(purchase__platform__name__icontains=search_string)
|
||||
| Q(device__name__icontains=search_string)
|
||||
| Q(device__type__icontains=search_string)
|
||||
)
|
||||
last_session = sessions.latest()
|
||||
page_obj = None
|
||||
if int(limit) != 0:
|
||||
|
|
Loading…
Reference in New Issue