File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ def get_similar_events(event_slug: str) -> list[Event]:
1212 event = get_object_or_404 (Event , slug = event_slug )
1313 exclude_current = ~ Q (id = event .id )
1414 similarity_query = Q ()
15+ published_filter = Q (status = Event .EventStatus .PUBLISHED )
1516
1617 if event .playlists .exists ():
1718 similarity_query |= Q (playlists__in = event .playlists .all ())
@@ -20,8 +21,8 @@ def get_similar_events(event_slug: str) -> list[Event]:
2021 if event .tags .exists ():
2122 similarity_query |= Q (tags__in = event .tags .all ())
2223
23- similar_events = Event .objects .filter (exclude_current & similarity_query ).distinct ()
24- latest_events = Event .objects .filter (exclude_current ).order_by ('-event_time' )[:5 ]
24+ similar_events = Event .objects .filter (exclude_current & similarity_query & published_filter ).distinct ()
25+ latest_events = Event .objects .filter (exclude_current & published_filter ).order_by ('-event_time' )[:5 ]
2526
2627 combined_events = list (similar_events ) + list (latest_events )
2728 unique_events = {event .id : event for event in combined_events }.values ()
You can’t perform that action at this time.
0 commit comments