Skip to content

Commit

Permalink
Logged out circles
Browse files Browse the repository at this point in the history
  • Loading branch information
blopker committed Oct 24, 2023
1 parent 0e85c25 commit 3bfb293
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions totem/circles/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ def upcoming_events_user_can_attend(user: User, limit: int = 3):
if len(filtered_events) >= limit:
break
return filtered_events


def logged_out_sessions_list():
events = CircleEvent.objects.filter(start__gte=timezone.now(), cancelled=False, open=True)
events = events.order_by("start")
events = events.filter(circle__published=True)
return events
3 changes: 2 additions & 1 deletion totem/circles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from totem.users.models import User
from totem.utils.hash import basic_hash

from .filters import logged_out_sessions_list
from .models import Circle, CircleEvent, CircleEventException

ICS_QUERY_PARAM = "key"
Expand Down Expand Up @@ -128,7 +129,7 @@ def list(request):
if request.user.is_authenticated:
context = _logged_in_list(request.user)
else:
events = CircleEvent.objects.filter(start__gte=timezone.now()).order_by("start")
events = logged_out_sessions_list()
context = {"events": events, "attending_events": []}
return render(request, "circles/list.html", context=context)

Expand Down

0 comments on commit 3bfb293

Please sign in to comment.