def portfolios(request): context = RequestContext(request) breadcrumb = (("Community", "/community"),("Portfolios",None)) portfolios = get_recently_updated_portfolios() portfolios_paginator = RhizomePaginator(portfolios, per_page=50, url=request.get_full_path()) d= { "breadcrumb":breadcrumb, "portfolios_paginator": portfolios_paginator, "grouped": browse_helper(request, portfolios_paginator), } return render_to_response("accounts/portfolios.html", d, context)
def profiles_list(request): context = RequestContext(request) sort = request.GET.get("sort") breadcrumb = ( ('Community', '/community/'), ('Profiles', None), ) if sort: users = RhizomeUser.objects \ .filter( \ Q(last_name__istartswith=sort) | \ Q(first_name__istartswith=sort) | \ Q(username__istartswith=sort) \ ) \ .filter(visible=True) \ .filter(is_active=True) \ .order_by('user__username', 'user__first_name', 'user__last_name') cleaned_users = remove_duplicates_and_preserve_order(users) accounts_paginator = RhizomePaginator(cleaned_users, per_page=150, url=request.get_full_path()) else: users = RhizomeUser.objects \ .filter(visible=True) \ .filter(is_active=True) \ .order_by('-user_rating__rating', 'user__username', 'user__first_name', 'user__last_name') accounts_paginator = RhizomePaginator(users, per_page=150, url=request.get_full_path()) alphabet = [chr(i) for i in xrange(ord('a'), ord('z') + 1)] return render_to_response( "accounts/profiles_list.html", { "accounts_paginator": accounts_paginator, "alphabet": alphabet, "sort": sort, "updated_portfolios": get_recently_updated_portfolios(45), "grouped": browse_helper(request, accounts_paginator), 'breadcrumb': breadcrumb }, context)
def profiles_list(request): context = RequestContext(request) sort = request.GET.get("sort") breadcrumb = (('Community', '/community/'), ('Profiles', None),) if sort: users = RhizomeUser.objects \ .filter( \ Q(last_name__istartswith=sort) | \ Q(first_name__istartswith=sort) | \ Q(username__istartswith=sort) \ ) \ .filter(visible=True) \ .filter(is_active=True) \ .order_by('user__username', 'user__first_name', 'user__last_name') cleaned_users = remove_duplicates_and_preserve_order(users) accounts_paginator = RhizomePaginator(cleaned_users, per_page=150, url=request.get_full_path()) else: users = RhizomeUser.objects \ .filter(visible=True) \ .filter(is_active=True) \ .order_by('-user_rating__rating', 'user__username', 'user__first_name', 'user__last_name') accounts_paginator = RhizomePaginator(users, per_page=150, url=request.get_full_path()) alphabet = [chr(i) for i in xrange(ord('a'), ord('z')+1)] return render_to_response( "accounts/profiles_list.html", {"accounts_paginator": accounts_paginator, "alphabet":alphabet, "sort":sort, "updated_portfolios": get_recently_updated_portfolios(45), "grouped": browse_helper(request, accounts_paginator), 'breadcrumb': breadcrumb }, context )