def electioneering_communications(): return render_template( 'datatable.html', slug='electioneering-communications', title='Electioneering communications', dates=utils.date_ranges(), columns=constants.table_columns['electioneering-communications'])
def communication_costs(): return render_template( 'datatable.html', slug='communication-costs', title='Communication costs', dates=utils.date_ranges(), columns=constants.table_columns['communication-costs'])
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')
def independent_expenditures(): return render_template( 'datatable.html', slug='independent-expenditures', title='Independent expenditures', dates=utils.date_ranges(), columns=constants.table_columns['independent-expenditures'])
def filings(): return render_template('datatable.html', slug='filings', title='Filings', dates=utils.date_ranges(), result_type='committees', columns=constants.table_columns['filings'])
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'])
def disbursements(): return render_template( 'datatable.html', slug='disbursements', title='Disbursements', dates=utils.date_ranges(), columns=constants.table_columns['disbursements'] )
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'])
def independent_expenditures(): return render_template( 'datatable.html', slug='independent-expenditures', title='Independent expenditures', dates=utils.date_ranges(), columns=constants.table_columns['independent-expenditures'] )
def receipts(): return render_template( 'datatable.html', slug='receipts', title='Receipts', dates=utils.date_ranges(), columns=constants.table_columns['receipts'] )
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')
def electioneering_communications(): return render_template( 'datatable.html', slug='electioneering-communications', title='Electioneering communications', dates=utils.date_ranges(), columns=constants.table_columns['electioneering-communications'] )
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())
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)
def communication_costs(): return render_template( 'datatable.html', slug='communication-costs', title='Communication costs', dates=utils.date_ranges(), columns=constants.table_columns['communication-costs'] )
def receipts(): return render_template( 'datatable.html', parent='data', slug='receipts', title='Receipts', dates=utils.date_ranges(), columns=constants.table_columns['receipts'] )
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'] )
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'] )
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)
def filings(): return render_template( 'datatable.html', slug='filings', title='Filings', dates=utils.date_ranges(), result_type='committees', columns=constants.table_columns['filings'] )
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 )
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 )
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'] )
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')
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()] )
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()] )
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')
def independent_expenditures(): return render_template('independent-expenditures.html', dates=utils.date_ranges())
def communication_costs(): return render_template('communication-costs.html', dates=utils.date_ranges())
def filings(): return render_template( 'filings.html', dates=utils.date_ranges(), result_type='committees', )
def disbursements(): return render_template('datatable.html', slug='disbursements', title='Disbursements', dates=utils.date_ranges(), columns=constants.table_columns['disbursements'])
def electioneering_communications(): return render_template('electioneering-communications.html', dates=utils.date_ranges())
def filings(): return render_template("filings.html", dates=utils.date_ranges(), result_type="committees")
def disbursements(): return render_template("disbursements.html", dates=utils.date_ranges())
def receipts(): return render_template("receipts.html", dates=utils.date_ranges())
def committees(): return render_template("committees.html", result_type="committees", dates=utils.date_ranges())