Mercurial > public > sg101
diff gpp/bio/views.py @ 149:ab7830b067b3
Implement ticket #40. Added a simple way to search for usernames and then view their profile. Moved this ajax username search feature out of the messages app and into core.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 14 Dec 2009 05:07:28 +0000 |
parents | 152d77265da6 |
children | d51743322bb2 |
line wrap: on
line diff
--- a/gpp/bio/views.py Sun Dec 13 21:57:34 2009 +0000 +++ b/gpp/bio/views.py Mon Dec 14 05:07:28 2009 +0000 @@ -23,6 +23,7 @@ from bio.forms import UploadAvatarForm from bio.forms import EditUserForm from bio.forms import EditUserProfileForm +from bio.forms import SearchUsersForm from core.paginator import DiggPaginator from core.functions import email_admins @@ -240,3 +241,21 @@ }, context_instance=RequestContext(request)) +####################################################################### + +@login_required +def member_search(request): + if request.method == "POST": + form = SearchUsersForm(request.POST) + if form.is_valid(): + username = form.cleaned_data['username'] + return HttpResponseRedirect(reverse("bio-view_profile", + kwargs={'username': username})) + else: + form = SearchUsersForm() + + return render_to_response('bio/member_search.html', { + 'form': form, + }, + context_instance=RequestContext(request)) +