comparison 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
comparison
equal deleted inserted replaced
148:35a0e6345815 149:ab7830b067b3
21 from bio.models import UserProfile 21 from bio.models import UserProfile
22 from bio.models import UserProfileFlag 22 from bio.models import UserProfileFlag
23 from bio.forms import UploadAvatarForm 23 from bio.forms import UploadAvatarForm
24 from bio.forms import EditUserForm 24 from bio.forms import EditUserForm
25 from bio.forms import EditUserProfileForm 25 from bio.forms import EditUserProfileForm
26 from bio.forms import SearchUsersForm
26 from core.paginator import DiggPaginator 27 from core.paginator import DiggPaginator
27 from core.functions import email_admins 28 from core.functions import email_admins
28 29
29 ####################################################################### 30 #######################################################################
30 31
238 'im_form': im_form, 239 'im_form': im_form,
239 'w_form': w_form, 240 'w_form': w_form,
240 }, 241 },
241 context_instance=RequestContext(request)) 242 context_instance=RequestContext(request))
242 243
244 #######################################################################
245
246 @login_required
247 def member_search(request):
248 if request.method == "POST":
249 form = SearchUsersForm(request.POST)
250 if form.is_valid():
251 username = form.cleaned_data['username']
252 return HttpResponseRedirect(reverse("bio-view_profile",
253 kwargs={'username': username}))
254 else:
255 form = SearchUsersForm()
256
257 return render_to_response('bio/member_search.html', {
258 'form': form,
259 },
260 context_instance=RequestContext(request))
261