Exemple #1
0
def sections(request):
    """Shows a page where all sections are listed for the user to
    select one.
    """
    if len(settings.LANGUAGE_SECTIONS) == 1:
        return redirect(url_for("kb.overview", lang_code=settings.LANGUAGE_SECTIONS[0]))
    return render_template("kb/sections.html", languages=list_sections())
Exemple #2
0
def sections(request):
    """Shows a page where all sections are listed for the user to
    select one.
    """
    if len(settings.LANGUAGE_SECTIONS) == 1:
        return redirect(
            url_for('kb.overview', lang_code=settings.LANGUAGE_SECTIONS[0]))
    return render_template('kb/sections.html', languages=list_sections())
Exemple #3
0
def userlist(request, locale=None):
    """Displays list of users.  Optionally a locale identifier can be passed
    in that replaces the default "all users" query.  This is used by the
    userlist form the knowledge base that forwards the call here.
    """
    query = User.query
    if locale is not None:
        # if we just have one language, we ignore that there is such a thing
        # as being active in a section of the webpage and redirect to the
        # general user list.
        if len(settings.LANGUAGE_SECTIONS) == 1:
            return redirect(url_for('users.userlist'))
        locale = Locale.parse(locale)
        query = query.active_in(locale)
    query = query.order_by(User.reputation.desc())
    pagination = Pagination(request, query, request.args.get('page', type=int))
    return render_template('users/userlist.html', pagination=pagination,
                           users=pagination.get_objects(), locale=locale,
                           sections=list_sections())
Exemple #4
0
def userlist(request, locale=None):
    """Displays list of users.  Optionally a locale identifier can be passed
    in that replaces the default "all users" query.  This is used by the
    userlist form the knowledge base that forwards the call here.
    """
    query = User.query
    if locale is not None:
        # if we just have one language, we ignore that there is such a thing
        # as being active in a section of the webpage and redirect to the
        # general user list.
        if len(settings.LANGUAGE_SECTIONS) == 1:
            return redirect(url_for('users.userlist'))
        locale = Locale.parse(locale)
        query = query.active_in(locale)
    query = query.order_by(User.reputation.desc())
    pagination = Pagination(request, query, request.args.get('page', type=int))
    return render_template('users/userlist.html',
                           pagination=pagination,
                           users=pagination.get_objects(),
                           locale=locale,
                           sections=list_sections())