Exemple #1
0
def show_bill_browse(template, request, ix1, ix2, context):
    if "text" in request.GET:
        # when the user is doing a text search, sort by standard Solr relevance scoring, which includes boosting the bill title
        default_sort = None
    elif "sponsor" in request.GET:
        # when searching by sponsor, the default order is to show bills in reverse chronological order
        default_sort = "-introduced_date"
    else:
        # otherwise in faceted searching, order by -proscore which puts more important bills up top
	    default_sort = "-proscore"

    return bill_search_manager().view(request, template,
        defaults={
            "congress": request.GET["congress"] if "congress" in request.GET else (CURRENT_CONGRESS if "sponsor" not in request.GET else None), # was Person.objects.get(id=request.GET["sponsor"]).most_recent_role_congress(), but we can just display the whole history which is better at the beginning of a Congress when there are no bills
            "sponsor": request.GET.get("sponsor", None),
            "terms": ix1.id if ix1 else None,
            "terms2": ix2.id if ix2 else None,
            "text": request.GET.get("text", None),
            "current_status": request.GET.get("status").split(",") if "status" in request.GET else None,
            "sort": default_sort,
            "usc_cite": request.GET.get("usc_cite"),
        },
        noun = ("bill", "bills"),
        context = context,
        )
Exemple #2
0
def show_bill_browse(template, request, ix1, ix2, context):
    if "sort" in request.GET:
        # pass through
        default_sort = request.GET["sort"]
    elif "text" in request.GET:
        # when the user is doing a text search, sort by standard Solr relevance scoring, which includes boosting the bill title
        default_sort = None
    elif "sponsor" in request.GET:
        # when searching by sponsor, the default order is to show bills in reverse chronological order
        default_sort = "-introduced_date"
    else:
        # otherwise in faceted searching, order by -proscore which puts more important bills up top
	    default_sort = "-proscore"

    return bill_search_manager().view(request, template,
        defaults={
            "congress": request.GET["congress"] if "congress" in request.GET else (CURRENT_CONGRESS if "sponsor" not in request.GET else None), # was Person.objects.get(id=request.GET["sponsor"]).most_recent_role_congress(), but we can just display the whole history which is better at the beginning of a Congress when there are no bills
            "sponsor": request.GET.get("sponsor", None),
            "terms": ix1.id if ix1 else None,
            "terms2": ix2.id if ix2 else None,
            "text": request.GET.get("text", None),
            "current_status": request.GET.get("status").split(",") if "status" in request.GET else None,
            "sort": default_sort,
            "usc_cite": request.GET.get("usc_cite"),
        },
        noun = ("bill", "bills"),
        context = context,
        )
Exemple #3
0
def show_bill_browse(template, request, ix1, ix2, context):
    return bill_search_manager().view(
        request,
        template,
        defaults={
            "congress":
            request.GET["congress"] if "congress" in request.GET else (
                CURRENT_CONGRESS if "sponsor" not in request.GET else None
            ),  # was Person.objects.get(id=request.GET["sponsor"]).most_recent_role_congress(), but we can just display the whole history which is better at the beginning of a Congress when there are no bills
            "sponsor":
            request.GET.get("sponsor", None),
            "terms":
            ix1.id if ix1 else None,
            "terms2":
            ix2.id if ix2 else None,
            "text":
            request.GET.get("text", None),
            "current_status":
            request.GET.get("status").split(",")
            if "status" in request.GET else None,
            "sort":
            request.GET.get(
                "sort",
                None if "sponsor" not in request.GET else "-introduced_date"),
            "usc_cite":
            request.GET.get("usc_cite"),
        },
        noun=("bill", "bills"),
        context=context,
    )
Exemple #4
0
def show_bill_browse(template, request, ix1, ix2, context):
    return bill_search_manager().view(request, template,
        defaults={
            "congress": request.GET["congress"] if "congress" in request.GET else (CURRENT_CONGRESS if "sponsor" not in request.GET else None), # was Person.objects.get(id=request.GET["sponsor"]).most_recent_role_congress(), but we can just display the whole history which is better at the beginning of a Congress when there are no bills
            "sponsor": request.GET.get("sponsor", None),
            "terms": ix1.id if ix1 else None,
            "terms2": ix2.id if ix2 else None,
            "text": request.GET.get("text", None),
            "current_status": request.GET.get("status").split(",") if "status" in request.GET else None,
            "sort": request.GET.get("sort", None if "sponsor" not in request.GET else "-introduced_date"),
        },
        noun = ("bill", "bills"),
        context = context,
        )