@login_required
def deployments(request, template='appstore/deployments.html'):
    (params, _) = parse_args_for_es(request)
    params = dict([(DEPLOYMENT_MAPPING.get(p, p), params[p]) for p in params])
    page = int(params.pop('page', 1))
    results = es_deployments_query(params, DEPLOYMENT_FACETS)
    d_results = [Domain.wrap(res['_source']) for res in results['hits']['hits']]
    more_pages = (False if (len(d_results) <= (page * 10)) else True)
    facet_map = fill_mapping_with_facets(DEPLOYMENT_MAPPING, results, params)
    include_unapproved = (True if (request.GET.get('is_approved', '') == 'false') else False)
    vals = {'deployments': d_results[((page - 1) * 10):(page * 10)], 'page': page, 'prev_page': (page - 1), 'next_page': (page + 1), 'more_pages': more_pages, 'include_unapproved': include_unapproved, 'facet_map': facet_map, 'query_str': request.META['QUERY_STRING'], 'search_url': reverse('deployments'), 'search_query': params.get('search', [''])[0]}
    return render(request, template, vals)
@login_required
def deployments(request, template='appstore/deployments.html'):
    (params, _) = parse_args_for_es(request)
    params = dict([(DEPLOYMENT_MAPPING.get(p, p), params[p]) for p in params])
    page = int(params.pop('page', 1))
    results = es_deployments_query(params, DEPLOYMENT_FACETS)
    d_results = [Domain.wrap(res['_source']) for res in results['hits']['hits']]
    more_pages = (False if (len(d_results) <= (page * 10)) else True)
    facet_map = fill_mapping_with_facets(DEPLOYMENT_MAPPING, results, params)
    include_unapproved = (True if (request.GET.get('is_approved', ) == 'false') else False)
    vals = {'deployments': d_results[((page - 1) * 10):(page * 10)], 'page': page, 'prev_page': (page - 1), 'next_page': (page + 1), 'more_pages': more_pages, 'include_unapproved': include_unapproved, 'facet_map': facet_map, 'query_str': request.META['QUERY_STRING'], 'search_url': reverse('deployments'), 'search_query': params.get('search', [])[0]}
    return render(request, template, vals)