yournextrepresentative
yournextrepresentative copied to clipboard
Candidacy-specific information
I found myself wanting to attach candidacy statements but unlike most other data these are specific to an election. If a person runs again in a new election, that statement should either not be shown or be shown in such a way that it's clear it belongs to another election. Adding the name of the election or the date in parentheses in the label feels kinda clumsy - I'm thinking there should be a way to associate extra fields to a candidacy and for those fields to appear in close proximity to their respective candidacy.
I agree in principle that you should be able to have customizable crowd-sourced fields for each candidacy. I think this won't be a small thing to implement, however. (More details on that below...)
From what you've said above it sounds as if you realise this could be done by adding an ExtraField
in the admin interface, called something like "Candidacy Statement 2016". Given the time constraint, I'd strongly suggest taking this approach. It's not elegant in data modelling terms, but it should work fine for this election, and it would be easy to migrate later to a better model.
In terms of how this could be implemented, I think we want to allow users to enter data that is unique to:
- A person,
- a post
- and an election
(Some bits of the code do support the same person standing for multiple different posts in one election, but most don't. I'm sure this is going to come up sooner or later, though, so I prefer for the data model to support that where possible.)
One way of doing this would be to extend ExtraField
to have a nullable election
ForeignKey, and add nullable post
and election
fields to PersonExtraFieldValue
.
The awkward bit is that you then only want that field to appear on the edit / new person forms when they're marked as standing in that election, which means updating the Javascript that shows and hides fields depending on the election and post that are selected.
Other things to remember to do: make sure the extra fields are added to the API, and are serialized / deserialized in the versions array.