예제 #1
0
def electioneering_communications():
    return render_template(
        'datatable.html',
        slug='electioneering-communications',
        title='Electioneering communications',
        dates=utils.date_ranges(),
        columns=constants.table_columns['electioneering-communications'])
예제 #2
0
def communication_costs():
    return render_template(
        'datatable.html',
        slug='communication-costs',
        title='Communication costs',
        dates=utils.date_ranges(),
        columns=constants.table_columns['communication-costs'])
예제 #3
0
def search():
    """Renders the top-level /data page.

    If there's a query string, it will
    load candidate and committee search results.

    If the string is a 16 or 11 digit number then it will redirect to
    the page-by-page viewer.

    If there's no query, then we'll load the main landing page with all the
    necessary data.
    """
    query = request.args.get('search')

    if query:
        if re.match('\d{16}', query) or re.match('\d{11}', query):
            url = 'http://docquery.fec.gov/cgi-bin/fecimg/?' + query
            return redirect(url)
        else:
            results = api_caller.load_search_results(query)
            return views.render_search_results(results, query)

    else:
        top_candidates_raising = api_caller.load_top_candidates('-receipts', per_page=3)
        return render_template('landing.html',
            page='home',
            parent='data',
            dates=utils.date_ranges(),
            top_candidates_raising=top_candidates_raising['results'] if top_candidates_raising else None,
            first_of_year=datetime.date(datetime.date.today().year, 1, 1).strftime('%m/%d/%Y'),
            last_of_year=datetime.date(datetime.date.today().year, 12, 31).strftime('%m/%d/%Y'),
            title='Campaign finance data')
예제 #4
0
def independent_expenditures():
    return render_template(
        'datatable.html',
        slug='independent-expenditures',
        title='Independent expenditures',
        dates=utils.date_ranges(),
        columns=constants.table_columns['independent-expenditures'])
예제 #5
0
def filings():
    return render_template('datatable.html',
                           slug='filings',
                           title='Filings',
                           dates=utils.date_ranges(),
                           result_type='committees',
                           columns=constants.table_columns['filings'])
예제 #6
0
def individual_contributions():
    return render_template('datatable.html',
                           result_type='receipts',
                           title='Individual contributions',
                           slug='individual-contributions',
                           dates=utils.date_ranges(),
                           columns=constants.table_columns['receipts'])
예제 #7
0
def disbursements():
    return render_template(
        'datatable.html',
        slug='disbursements',
        title='Disbursements',
        dates=utils.date_ranges(),
        columns=constants.table_columns['disbursements']
    )
예제 #8
0
def party_coordinated_expenditures():
    return render_template(
        'datatable.html',
        parent='data',
        slug='party-coordinated-expenditures',
        title='Party coordinated expenditures',
        dates=utils.date_ranges(),
        columns=constants.table_columns['party-coordinated-expenditures'])
예제 #9
0
def independent_expenditures():
    return render_template(
        'datatable.html',
        slug='independent-expenditures',
        title='Independent expenditures',
        dates=utils.date_ranges(),
        columns=constants.table_columns['independent-expenditures']
    )
예제 #10
0
def receipts():
    return render_template(
        'datatable.html',
        slug='receipts',
        title='Receipts',
        dates=utils.date_ranges(),
        columns=constants.table_columns['receipts']
    )
예제 #11
0
def search():
    query = request.args.get('search')
    if query:
        result_type = request.args.get('search_type') or 'candidates'
        results = api_caller.load_search_results(query, result_type)
        return views.render_search_results(results, query, result_type)
    else:
        return render_template('search.html', page='home', dates=utils.date_ranges(), title='Campaign finance data')
예제 #12
0
def electioneering_communications():
    return render_template(
        'datatable.html',
        slug='electioneering-communications',
        title='Electioneering communications',
        dates=utils.date_ranges(),
        columns=constants.table_columns['electioneering-communications']
    )
예제 #13
0
def search():
    query = request.args.get("search")
    if query:
        result_type = request.args.get("search_type") or "candidates"
        results = load_search_results(query, result_type)
        return views.render_search_results(results, query, result_type)
    else:
        return render_template("search.html", page="home", dates=utils.date_ranges())
예제 #14
0
def disbursements():
    return render_template('datatable.html',
                           parent='data',
                           slug='disbursements',
                           title='Disbursements',
                           dates=utils.date_ranges(),
                           columns=constants.table_columns['disbursements'],
                           has_data_type_toggle=True)
예제 #15
0
def communication_costs():
    return render_template(
        'datatable.html',
        slug='communication-costs',
        title='Communication costs',
        dates=utils.date_ranges(),
        columns=constants.table_columns['communication-costs']
    )
예제 #16
0
def receipts():
    return render_template(
        'datatable.html',
        parent='data',
        slug='receipts',
        title='Receipts',
        dates=utils.date_ranges(),
        columns=constants.table_columns['receipts']
    )
예제 #17
0
def individual_contributions():
    return render_template(
        'datatable.html',
        result_type='receipts',
        title='Individual contributions',
        slug='individual-contributions',
        dates=utils.date_ranges(),
        columns=constants.table_columns['receipts']
    )
예제 #18
0
def party_coordinated_expenditures():
    return render_template(
        'datatable.html',
        parent='data',
        slug='party-coordinated-expenditures',
        title='Party coordinated expenditures',
        dates=utils.date_ranges(),
        columns=constants.table_columns['party-coordinated-expenditures']
    )
예제 #19
0
def independent_expenditures():
    return render_template(
        'datatable.html',
        parent='data',
        slug='independent-expenditures',
        title='Independent expenditures',
        dates=utils.date_ranges(),
        columns=constants.table_columns['independent-expenditures'],
        has_data_type_toggle=True)
예제 #20
0
def filings():
    return render_template(
        'datatable.html',
        slug='filings',
        title='Filings',
        dates=utils.date_ranges(),
        result_type='committees',
        columns=constants.table_columns['filings']
    )
예제 #21
0
def disbursements():
    return render_template(
        'datatable.html',
        parent='data',
        slug='disbursements',
        title='Disbursements',
        dates=utils.date_ranges(),
        columns=constants.table_columns['disbursements'],
        has_data_type_toggle=True
    )
예제 #22
0
def independent_expenditures():
    return render_template(
        'datatable.html',
        parent='data',
        slug='independent-expenditures',
        title='Independent expenditures',
        dates=utils.date_ranges(),
        columns=constants.table_columns['independent-expenditures'],
        has_data_type_toggle=True
    )
예제 #23
0
def committees():
    return render_template(
        'datatable.html',
        parent='data',
        result_type='committees',
        slug='committees',
        title='Committees',
        dates=utils.date_ranges(),
        columns=constants.table_columns['committees']
    )
예제 #24
0
def search():
    query = request.args.get('search')
    if query:
        result_type = request.args.get('search_type') or 'candidates'
        results = api_caller.load_search_results(query, result_type)
        return views.render_search_results(results, query, result_type)
    else:
        return render_template('search.html',
                               page='home',
                               dates=utils.date_ranges(),
                               title='Campaign finance data')
예제 #25
0
def search():
    query = request.args.get('search')
    if query:
        result_type = request.args.get('search_type') or 'candidates'
        results = api_caller.load_search_results(query, result_type)
        return views.render_search_results(results, query, result_type)
    else:
        return render_template('landing.html',
            page='home',
            parent='data',
            dates=utils.date_ranges(),
            top_candidates_raising = api_caller.load_top_candidates('-receipts')['results'],
            top_candidates_spending = api_caller.load_top_candidates('-disbursements')['results'],
            top_pacs_raising = api_caller.load_top_pacs('-receipts')['results'],
            top_pacs_spending = api_caller.load_top_pacs('-disbursements')['results'],
            top_parties_raising = api_caller.load_top_parties('-receipts')['results'],
            top_parties_spending = api_caller.load_top_parties('-disbursements')['results'],
            title='Campaign finance data')
예제 #26
0
def reports(form_type):
    if form_type.lower() not in ['presidential', 'house-senate', 'pac-party', 'ie-only']:
        abort(404)
    if form_type.lower() == 'presidential':
        title = 'Presidential committee reports'
    if form_type.lower() == 'house-senate':
        title = 'House and Senate committee reports'
    if form_type.lower() == 'pac-party':
        title = 'PAC and party committee reports'
    if form_type.lower() == 'ie-only':
        title = 'Independent expenditure only committee reports'
    context = OrderedDict([('form_type', form_type.lower())])
    return render_template(
        'datatable.html',
        parent='data',
        slug='reports',
        title=title,
        table_context=context,
        dates=utils.date_ranges(),
        columns=constants.table_columns['reports-' + form_type.lower()]
    )
예제 #27
0
def reports(form_type):
    if form_type.lower() not in ['presidential', 'house-senate', 'pac-party', 'ie-only']:
        abort(404)
    if form_type.lower() == 'presidential':
        title = 'Presidential committee reports'
    if form_type.lower() == 'house-senate':
        title = 'House and Senate committee reports'
    if form_type.lower() == 'pac-party':
        title = 'PAC and party committee reports'
    if form_type.lower() == 'ie-only':
        title = 'Independent expenditure only committee reports'
    context = OrderedDict([('form_type', form_type.lower())])
    return render_template(
        'datatable.html',
        parent='data',
        slug='reports',
        title=title,
        table_context=context,
        dates=utils.date_ranges(),
        has_data_type_toggle=True,
        columns=constants.table_columns['reports-' + form_type.lower()]
    )
예제 #28
0
def search():
    """Renders the top-level /data page.

    If there's a query string, it will
    load candidate and committee search results.

    If the string is a 16 or 11 digit number then it will redirect to
    the page-by-page viewer.

    If there's no query, then we'll load the main landing page with all the
    necessary data.
    """
    query = request.args.get('search')

    if query:
        if re.match('\d{16}', query) or re.match('\d{11}', query):
            url = 'http://docquery.fec.gov/cgi-bin/fecimg/?' + query
            return redirect(url)
        else:
            results = api_caller.load_search_results(query)
            return views.render_search_results(results, query)

    else:
        top_candidates_raising = api_caller.load_top_candidates('-receipts',
                                                                per_page=3)
        return render_template(
            'landing.html',
            page='home',
            parent='data',
            dates=utils.date_ranges(),
            top_candidates_raising=top_candidates_raising['results']
            if top_candidates_raising else None,
            first_of_year=datetime.date(datetime.date.today().year, 1,
                                        1).strftime('%m/%d/%Y'),
            last_of_year=datetime.date(datetime.date.today().year, 12,
                                       31).strftime('%m/%d/%Y'),
            title='Campaign finance data')
예제 #29
0
def independent_expenditures():
    return render_template('independent-expenditures.html', dates=utils.date_ranges())
예제 #30
0
def communication_costs():
    return render_template('communication-costs.html', dates=utils.date_ranges())
예제 #31
0
def filings():
    return render_template(
        'filings.html',
        dates=utils.date_ranges(),
        result_type='committees',
    )
예제 #32
0
def disbursements():
    return render_template('datatable.html',
                           slug='disbursements',
                           title='Disbursements',
                           dates=utils.date_ranges(),
                           columns=constants.table_columns['disbursements'])
예제 #33
0
def electioneering_communications():
    return render_template('electioneering-communications.html', dates=utils.date_ranges())
예제 #34
0
def filings():
    return render_template("filings.html", dates=utils.date_ranges(), result_type="committees")
예제 #35
0
def disbursements():
    return render_template("disbursements.html", dates=utils.date_ranges())
예제 #36
0
def receipts():
    return render_template("receipts.html", dates=utils.date_ranges())
예제 #37
0
def committees():
    return render_template("committees.html", result_type="committees", dates=utils.date_ranges())