(_('oldest'), pagination.SimpleSort(_('oldest answers'), 'added_at', _("oldest answers will be shown first"))),\r
(_('newest'), pagination.SimpleSort(_('newest answers'), '-added_at', _("newest answers will be shown first"))),\r
(_('votes'), pagination.SimpleSort(_('popular answers'), '-score', _("most voted answers will be shown first"))),\r
- ), default_sort=_('votes'), sticky_sort = True, pagesizes=(5, 10, 20), default_pagesize=20, prefix=_('answers'))\r
+ ), default_sort=_('votes'), pagesizes=(5, 10, 20), default_pagesize=20, prefix=_('answers'))\r
\r
USERS_PAGE_SIZE = 35# refactor - move to some constants file\r
\r
suser = request.REQUEST.get('q', "")\r
users = User.objects.all()\r
\r
- if suser == "":\r
+ if suser != "":\r
users = users.filter(username__icontains=suser)\r
\r
return pagination.paginated(request, ('users', UserListPaginatorContext()), {\r
\r
return {'view_user':user, 'notificatons_on': enabled, 'form':form}\r
\r
+@user_view('users/preferences.html', 'preferences', _('preferences'), _('preferences'), True, tabbed=False)\r
+def user_preferences(request, user):\r
+ if request.POST:\r
+ form = UserPreferencesForm(request.POST)\r
+\r
+ if form.is_valid():\r
+ user.prop.preferences = form.cleaned_data\r
+ request.user.message_set.create(message=_('New preferences saved'))\r
+\r
+ else:\r
+ preferences = user.prop.preferences\r
+\r
+ if preferences:\r
+ form = UserPreferencesForm(initial=preferences)\r
+ else:\r
+ form = UserPreferencesForm()\r
+ \r
+ return {'view_user': user, 'form': form}\r
+\r
@login_required\r
def account_settings(request):\r
logging.debug('')\r