Skip to content

Commit

Permalink
If only one user in search results, redirects to that user page
Browse files Browse the repository at this point in the history
  • Loading branch information
abkruse committed Dec 26, 2016
1 parent c6e1a0f commit 781b26b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions members/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def view_members(request):
if search_form.is_valid():
search_terms = search_form.cleaned_data['terms']
search_results = User.helper.search(search_terms, True)
if len(search_results) == 1:
return HttpResponseRedirect(reverse('member_profile', kwargs={'username': search_results[0].username}))
else:
search_form = MemberSearchForm()

Expand Down

0 comments on commit 781b26b

Please sign in to comment.