def landing(request): top_candidates_raising = api_caller.load_top_candidates("-receipts", per_page=3) return render( request, "landing.jinja", { "parent": "data", "title": "Campaign finance data", "dates": utils.date_ranges(), "top_candidates_raising": top_candidates_raising["results"] if top_candidates_raising else None, "first_of_year": date(date.today().year, 1, 1).strftime("%m/%d/%Y"), "last_of_year": date(date.today().year, 12, 31).strftime("%m/%d/%Y"), "social_image_identifier": "data", }, )
def reports(request, form_type): if form_type.lower() not in [ 'presidential', 'house-senate', 'pac-party', 'ie-only' ]: raise Http404() 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( request, 'datatable.jinja', { '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()], 'social_image_identifier': 'data', })
def electioneering_communications(request): return render( request, 'datatable.jinja', { 'parent': 'data', 'slug': 'electioneering-communications', 'title': 'Electioneering communications', 'dates': utils.date_ranges(), 'columns': constants.table_columns['electioneering-communications'] })
def communication_costs(request): return render( request, 'datatable.jinja', { 'parent': 'data', 'slug': 'communication-costs', 'title': 'Communication costs', 'dates': utils.date_ranges(), 'columns': constants.table_columns['communication-costs'] })
def party_coordinated_expenditures(request): return render(request, 'datatable.jinja', { 'parent': 'data', 'slug': 'party-coordinated-expenditures', 'title': 'Party coordinated expenditures', 'dates': utils.date_ranges(), 'columns': constants.table_columns['party-coordinated-expenditures'], 'social_image_identifier': 'data', })
def disbursements(request): return render( request, 'datatable.jinja', { 'parent': 'data', 'slug': 'disbursements', 'title': 'Disbursements', 'dates': utils.date_ranges(), 'columns': constants.table_columns['disbursements'], 'has_data_type_toggle': True })
def individual_contributions(request): return render( request, 'datatable.jinja', { 'parent': 'data', 'result_type': 'receipts', 'title': 'Individual contributions', 'slug': 'individual-contributions', 'dates': utils.date_ranges(), 'columns': constants.table_columns['individual-contributions'] })
def independent_expenditures(request): return render( request, 'datatable.jinja', { 'parent': 'data', 'slug': 'independent-expenditures', 'title': 'Independent expenditures', 'dates': utils.date_ranges(), 'columns': constants.table_columns['independent-expenditures'], 'has_data_type_toggle': True })
def landing(request): top_candidates_raising = api_caller.load_top_candidates('-receipts', per_page=3) return render(request, 'landing.jinja', { 'title': 'Campaign finance 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'), })
def filings(request): return render( request, 'datatable.jinja', { 'parent': 'data', 'slug': 'filings', 'title': 'Filings', 'dates': utils.date_ranges(), 'result_type': 'committees', 'has_data_type_toggle': True, 'columns': constants.table_columns['filings'] })
def independent_expenditures(request): if len(request.GET) == 0: return redirect('/data/independent-expenditures/?most_recent=true') return render(request, 'datatable.jinja', { 'parent': 'data', 'slug': 'independent-expenditures', 'title': 'Independent expenditures', 'dates': utils.date_ranges(), 'columns': constants.table_columns['independent-expenditures'], 'has_data_type_toggle': True, 'social_image_identifier': 'data', })
def disbursements(request): if len(request.GET) == 0: return redirect('/data/disbursements/?two_year_transaction_period=' + str(constants.DEFAULT_ELECTION_YEAR) + '&min_date=' + '01/01/' + str(constants.DEFAULT_ELECTION_YEAR - 1) + '&max_date=' + '12/31/' + str(constants.DEFAULT_ELECTION_YEAR)) return render(request, 'datatable.jinja', { 'parent': 'data', 'slug': 'disbursements', 'title': 'Disbursements', 'dates': utils.date_ranges(), 'columns': constants.table_columns['disbursements'], 'has_data_type_toggle': True, 'social_image_identifier': 'data', })
def individual_contributions(request): if len(request.GET) == 0: return redirect('/data/receipts/individual-contributions/?two_year_transaction_period=' + str(constants.DEFAULT_ELECTION_YEAR) + '&min_date=' + '01/01/' + str(constants.DEFAULT_ELECTION_YEAR - 1) + '&max_date=' + '12/31/' + str(constants.DEFAULT_ELECTION_YEAR)) return render(request, 'datatable.jinja', { 'parent': 'data', 'result_type': 'receipts', 'title': 'Individual contributions', 'slug': 'individual-contributions', 'dates': utils.date_ranges(), 'columns': constants.table_columns['individual-contributions'], 'social_image_identifier': 'data', })