remove session recent filter

This commit is contained in:
Lukáš Kucharczyk 2024-08-11 17:58:08 +02:00
parent 6ef56bfed5
commit 020e12e20b
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
2 changed files with 1 additions and 13 deletions

View File

@ -82,12 +82,6 @@ urlpatterns = [
name="list_sessions_end_session", name="list_sessions_end_session",
), ),
path("session/list", sessionviews.list_sessions, name="list_sessions"), path("session/list", sessionviews.list_sessions, name="list_sessions"),
path(
"session/list/recent",
views.list_sessions,
{"filter": "recent"},
name="list_sessions_recent",
),
path( path(
"session/list/by-purchase/<int:purchase_id>", "session/list/by-purchase/<int:purchase_id>",
views.list_sessions, views.list_sessions,

View File

@ -342,12 +342,6 @@ def list_sessions(
elif filter == "ownership_type": elif filter == "ownership_type":
dataset = all_sessions.filter(purchase__ownership_type=ownership_type) dataset = all_sessions.filter(purchase__ownership_type=ownership_type)
context["ownership_type"] = dict(Purchase.OWNERSHIP_TYPES)[ownership_type] context["ownership_type"] = dict(Purchase.OWNERSHIP_TYPES)[ownership_type]
elif filter == "recent":
current_year = timezone.now().year
first_day_of_year = timezone.make_aware(datetime(current_year, 1, 1))
dataset = all_sessions.filter(timestamp_start__gte=first_day_of_year).order_by(
"-timestamp_start"
)
context["title"] = "This year" context["title"] = "This year"
else: else:
dataset = all_sessions dataset = all_sessions
@ -949,4 +943,4 @@ def add_device(request: HttpRequest) -> HttpResponse:
@login_required @login_required
def index(request: HttpRequest) -> HttpResponse: def index(request: HttpRequest) -> HttpResponse:
return redirect("list_sessions_recent") return redirect("list_sessions")