election models

class election.models.Candidate(*args, **kwargs)

A person who runs in a race for an office.

get_candidate_election(election)

Get a CandidateElection.

get_delegates()

Get all pledged delegates for this candidate.

get_election_delegates(election)

Get all pledged delegates for this candidate in an election.

get_election_electoral_votes(election)

Get all electoral votes for this candidate in an election.

get_election_votes(election)

Get all votes for this candidate in an election.

get_elections()

Get all elections a candidate is in.

save(*args, **kwargs)

uid: {person.uid}_candidate:{party.uid}-{cycle.ap_code}

class election.models.Party(*args, **kwargs)

A political party.

save(*args, **kwargs)

uid: party:{apcode}

class election.models.ElectionCycle(uid, slug, name)
save(*args, **kwargs)

uid: cycle:{year}

class election.models.ElectionType(*args, **kwargs)

e.g., “General”, “Primary”

save(*args, **kwargs)

uid: electiontype:{name}

class election.models.ElectionDay(*args, **kwargs)

A day on which one or many elections can be held.

save(*args, **kwargs)

uid: {cycle.uid}_date:{date}

special_election_datestring()

Formatted date string used in URL for special elections.

class election.models.Race(*args, **kwargs)

A race for an office comprised of one or many elections.

save(*args, **kwargs)

uid: {office.uid}_{cycle.uid}_race

class election.models.Election(*args, **kwargs)

A specific contest in a race held on a specific day.

delete_candidate(candidate)

Delete a CandidateElection.

get_candidate_delegates(candidate)

Get all pledged delegates for a candidate in this election.

get_candidate_election(candidate)

Get CandidateElection for a Candidate in this election.

get_candidate_electoral_votes(candidate)

Get all electoral votes for a candidate in this election.

get_candidate_votes(candidate)

Get all votes attached to a CandidateElection for a Candidate in this election.

get_candidates()

Get all CandidateElections for this election.

get_candidates_by_party()

Get CandidateElections serialized into an object with party-slug keys.

get_delegates()

Get all pledged delegates for any candidate in this election.

get_electoral_votes()

Get all electoral votes for all candidates in this election.

get_votes()

Get all votes for this election.

save(*args, **kwargs)

uid: {race.uid}_election:{election_day}-{party}

update_or_create_candidate(candidate, aggregable=True, uncontested=False)

Create a CandidateElection.

class election.models.CandidateElection(*args, **kwargs)

A CandidateEection represents the abstract relationship between a candidate and an election and carries properties like whether the candidate is uncontested or whether we aggregate their vote totals.

class election.models.BallotMeasure(*args, **kwargs)

A ballot measure.

save(*args, **kwargs)

uid: division_cycle_ballotmeasure:{number}

class election.models.BallotAnswer(*args, **kwargs)

An answer to a ballot question.