show group lists on group FindUsers page

This commit is contained in:
Hugh Rundle 2022-01-02 10:06:02 +11:00
parent b1fa57d2ca
commit 045506d6e0
No known key found for this signature in database
GPG key ID: CD23D6039184286B

View file

@ -122,6 +122,11 @@ class FindUsers(View):
"""basic profile info"""
user_query = request.GET.get("user_query")
group = get_object_or_404(models.Group, id=group_id)
lists = (
models.List.privacy_filter(request.user)
.filter(group=group)
.order_by("-updated_date")
)
if not group:
return HttpResponseBadRequest()
@ -143,7 +148,7 @@ class FindUsers(View):
.filter(similarity__gt=0.5, local=True)
.order_by("-similarity")[:5]
)
data = {"no_results": not user_results}
no_results = not user_results
if user_results.count() < 5:
user_results = list(user_results) + suggested_users.get_suggestions(
@ -152,7 +157,9 @@ class FindUsers(View):
data = {
"suggested_users": user_results,
"no_results": no_results,
"group": group,
"lists": lists,
"group_form": forms.GroupForm(instance=group,auto_id='group_form_id_%s'),
"list_form": forms.ListForm(),
"user_query": user_query,