Skip to content

Commit 4a38e06

Browse files
DidayoloObada Haddad
authored andcommitted
Get competitions organized for collaborators too
1 parent db42cbf commit 4a38e06

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/apps/profiles/views.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@ def get_context_data(self, **kwargs):
7070
context = super().get_context_data(**kwargs)
7171
user = self.get_object()
7272
user_data = UserSerializer(user).data
73-
# Fetch competitions organized by this user
73+
# Fetch competitions organized by this user (as owner or collaborator)
7474
organized_qs = (
7575
Competition.objects
76-
.filter(created_by=user, published=True)
76+
.filter(
77+
Q(created_by=user) | Q(collaborators=user),
78+
published=True,
79+
)
80+
.distinct()
7781
.order_by("-created_when")
7882
)
7983
# Serialize into the same shape your public-list cards expect

0 commit comments

Comments
 (0)