remove session recent filter
This commit is contained in:
parent
6ef56bfed5
commit
020e12e20b
|
@ -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,
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue