Esempio n. 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'])
Esempio n. 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'])
Esempio n. 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')
Esempio n. 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'])
Esempio n. 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'])
Esempio n. 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'])
Esempio n. 7
0
def disbursements():
    return render_template(
        'datatable.html',
        slug='disbursements',
        title='Disbursements',
        dates=utils.date_ranges(),
        columns=constants.table_columns['disbursements']
    )
Esempio n. 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'])
Esempio n. 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']
    )
Esempio n. 10
0
def receipts():
    return render_template(
        'datatable.html',
        slug='receipts',
        title='Receipts',
        dates=utils.date_ranges(),
        columns=constants.table_columns['receipts']
    )
Esempio n. 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')
Esempio n. 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']
    )
Esempio n. 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())
Esempio n. 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)
Esempio n. 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']
    )
Esempio n. 16
0
def receipts():
    return render_template(
        'datatable.html',
        parent='data',
        slug='receipts',
        title='Receipts',
        dates=utils.date_ranges(),
        columns=constants.table_columns['receipts']
    )
Esempio n. 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']
    )
Esempio n. 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']
    )
Esempio n. 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)
Esempio n. 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']
    )
Esempio n. 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
    )
Esempio n. 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
    )
Esempio n. 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']
    )
Esempio n. 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')
Esempio n. 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')
Esempio n. 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()]
    )
Esempio n. 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()]
    )
Esempio n. 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')
Esempio n. 29
0
def independent_expenditures():
    return render_template('independent-expenditures.html', dates=utils.date_ranges())
Esempio n. 30
0
def communication_costs():
    return render_template('communication-costs.html', dates=utils.date_ranges())
Esempio n. 31
0
def filings():
    return render_template(
        'filings.html',
        dates=utils.date_ranges(),
        result_type='committees',
    )
Esempio n. 32
0
def disbursements():
    return render_template('datatable.html',
                           slug='disbursements',
                           title='Disbursements',
                           dates=utils.date_ranges(),
                           columns=constants.table_columns['disbursements'])
Esempio n. 33
0
def electioneering_communications():
    return render_template('electioneering-communications.html', dates=utils.date_ranges())
Esempio n. 34
0
def filings():
    return render_template("filings.html", dates=utils.date_ranges(), result_type="committees")
Esempio n. 35
0
def disbursements():
    return render_template("disbursements.html", dates=utils.date_ranges())
Esempio n. 36
0
def receipts():
    return render_template("receipts.html", dates=utils.date_ranges())
Esempio n. 37
0
def committees():
    return render_template("committees.html", result_type="committees", dates=utils.date_ranges())