def user_board_listing(request, account_id): """Return a paginated board listing view for account with account_id.""" metric_timeout_seconds = 60 * 2 queries = { # default to boards contributed to None: lambda x: ('contributed to', user_boards_contributed(x, viewing_user=request.user)), 'created': lambda x: ('created', user_boards_created(x, viewing_user=request.user)), 'evaluated': lambda x: ('evaluated', user_boards_evaluated(x, viewing_user=request.user)), 'contribute': lambda x: ('contributed to', user_boards_contributed(x, viewing_user=request.user)), } user = get_object_or_404(User, pk=account_id) query = request.GET.get('query') verb, board_list = queries.get(query, queries[None])(user) desc = _('List of intelligence boards user {username} has {verb}').format(username=user.username, verb=verb) context = { 'user': user, 'boards': make_paginator(request, board_list), 'contributors': cache.get_or_set('contributor_count', generate_contributor_count(), metric_timeout_seconds), 'evaluators': cache.get_or_set('evaluator_count', generate_evaluator_count(), metric_timeout_seconds), 'meta_description': desc, 'verb': verb } return render(request, 'boards/user_boards.html', context)
def board_listing(request): """Return a paginated board listing view showing all boards and their popularity.""" board_list = Board.objects.user_readable( request.user).order_by("-pub_date") metric_timeout_seconds = 60 * 2 desc = _("List of intelligence boards on {name} and summary information" ).format(name=get_current_site(request).name) # nopep8 return render( request, "boards/boards.html", { "boards": make_paginator(request, board_list), "contributors": cache.get_or_set( "contributor_count", generate_contributor_count(), metric_timeout_seconds, ), "evaluators": cache.get_or_set("evaluator_count", generate_evaluator_count(), metric_timeout_seconds), "meta_description": desc, }, )
def board_listing(request): """Return a paginated board listing view showing all boards and their popularity.""" board_obj = Board.objects.user_readable( request.user).annotate(board_title_lower=Lower("board_title")) board_list = custom_sort(request, board_obj) metric_timeout_seconds = 60 * 2 desc = _("List of intelligence boards on {name} and summary information" ).format(name=get_current_site(request).name) # nopep8 name = request.GET.get("sort") myFilter = BoardFilter(request.GET, queryset=board_list) board_list = myFilter.qs return render( request, "boards/boards.html", { "boards": make_paginator(request, board_list), "contributors": cache.get_or_set( "contributor_count", generate_contributor_count(), metric_timeout_seconds, ), "evaluators": cache.get_or_set("evaluator_count", generate_evaluator_count(), metric_timeout_seconds), "meta_description": desc, "myFilter": myFilter, "sort": name, }, )
def user_board_listing(request, account_id): """Return a paginated board listing view for account with account_id.""" metric_timeout_seconds = 60 * 2 queries = { # default to boards contributed to None: lambda x: ( "contributed to", user_boards_contributed(x, viewing_user=request.user), ), "created": lambda x: ( "created", user_boards_created(x, viewing_user=request.user), ), "evaluated": lambda x: ( "evaluated", user_boards_evaluated(x, viewing_user=request.user), ), "contribute": lambda x: ( "contributed to", user_boards_contributed(x, viewing_user=request.user), ), } user = get_object_or_404(User, pk=account_id) query = request.GET.get("query") verb, board_list = queries.get(query, queries[None])(user) desc = _("List of intelligence boards user {username} has {verb}").format( username=user.username, verb=verb) return render( request, "boards/user_boards.html", { "user": user, "boards": make_paginator(request, board_list), "contributors": cache.get_or_set( "contributor_count", generate_contributor_count(), metric_timeout_seconds, ), "evaluators": cache.get_or_set("evaluator_count", generate_evaluator_count(), metric_timeout_seconds), "meta_description": desc, "verb": verb, }, )
def board_listing(request): """Return a paginated board listing view showing all boards and their popularity.""" board_list = Board.objects.user_readable(request.user).order_by('-pub_date') metric_timeout_seconds = 60 * 2 desc = _('List of intelligence boards on {name} and summary information').format(name=get_current_site(request).name) # nopep8 context = { 'boards': make_paginator(request, board_list), 'contributors': cache.get_or_set('contributor_count', generate_contributor_count(), metric_timeout_seconds), 'evaluators': cache.get_or_set('evaluator_count', generate_evaluator_count(), metric_timeout_seconds), 'meta_description': desc, } return render(request, 'boards/boards.html', context)