Modify some select2 box

This commit is contained in:
cuom1999 2024-02-05 15:15:32 -06:00
parent 847e8b6660
commit 695fa85b19
13 changed files with 50 additions and 31 deletions

View file

@ -200,3 +200,17 @@ class ChatUserSearchSelect2View(UserSearchSelect2View):
),
"display_rank": display_rank,
}
class ProblemAuthorSearchSelect2View(UserSearchSelect2View):
def get_queryset(self):
return Profile.objects.filter(
authored_problems__isnull=False, user__username__icontains=self.term
).distinct()
def get_json_result_from_object(self, user_tuple):
pk, username, email, display_rank, profile_image = user_tuple
return {
"text": username,
"id": pk,
}