@users.route('/users')
@check_account_visibility
def listing():
    q = request.args.get('q')
    field = request.args.get('field', 'name')
    if (field not in ('name', 'website')):
        field = 'name'
    filters = []
    if q:
        filters.append(getattr(Users, field).like('%{}%'.format(q)))
    users = Users.query.filter_by(banned=False, hidden=False).filter(*filters).order_by(Users.id.asc()).paginate(per_page=50)
    args = dict(request.args)
    args.pop('page', 1)
    return render_template('users/users.html', users=users, prev_page=url_for(request.endpoint, page=users.prev_num, **args), next_page=url_for(request.endpoint, page=users.next_num, **args), q=q, field=field)
@users.route('/users')
@check_account_visibility
def listing():
    q = request.args.get('q')
    field = request.args.get('field', 'name')
    if (field not in ('name', 'website')):
        field = 'name'
    filters = []
    if q:
        filters.append(getattr(Users, field).like('%{}%'.format(q)))
    users = Users.query.filter_by(banned=False, hidden=False).filter(*filters).order_by(Users.id.asc()).paginate(per_page=50)
    args = dict(request.args)
    args.pop('page', 1)
    return render_template('users/users.html', users=users, prev_page=url_for(request.endpoint, page=users.prev_num, **args), next_page=url_for(request.endpoint, page=users.next_num, **args), q=q, field=field)