add filter to show user profile

This commit is contained in:
alafin 2009-04-15 10:29:12 +03:00
parent e0de4973d7
commit 5b0d2cb071
3 changed files with 10 additions and 19 deletions

View file

@ -256,19 +256,19 @@ class UserSearchForm(forms.Form):
sort_dir = self.cleaned_data['sort_dir']
if sort_by=='username':
if sort_dir=='ASC':
return qs.filter(username__contains=username).order_by('username')
return qs.filter(username__contains=username, forum_profile__post_count__gte=forum_settings.POST_USER_SEARCH).order_by('username')
elif sort_dir=='DESC':
return qs.filter(username__contains=username).order_by('-username')
return qs.filter(username__contains=username, forum_profile__post_count__gte=forum_settings.POST_USER_SEARCH).order_by('-username')
elif sort_by=='registered':
if sort_dir=='ASC':
return qs.filter(username__contains=username).order_by('date_joined')
return qs.filter(username__contains=username, forum_profile__post_count__gte=forum_settings.POST_USER_SEARCH).order_by('date_joined')
elif sort_dir=='DESC':
return qs.filter(username__contains=username).order_by('-date_joined')
return qs.filter(username__contains=username, forum_profile__post_count__gte=forum_settings.POST_USER_SEARCH).order_by('-date_joined')
elif sort_by=='num_posts':
if sort_dir=='ASC':
return qs.filter(username__contains=username).order_by('forum_profile__post_count')
return qs.filter(username__contains=username, forum_profile__post_count__gte=forum_settings.POST_USER_SEARCH).order_by('forum_profile__post_count')
elif sort_dir=='DESC':
return qs.filter(username__contains=username).order_by('-forum_profile__post_count')
return qs.filter(username__contains=username, forum_profile__post_count__gte=forum_settings.POST_USER_SEARCH).order_by('-forum_profile__post_count')
else:
return qs