-
Notifications
You must be signed in to change notification settings - Fork 0
Working with the Admin Site
The admin site can be found at /admin
(for login credentials enquire with the previous CRO) and is used to set up ElectionSessions
, Elections
, Candidates
for each Election
and Eligibilities
for each Election
. These can be done either manually or automatically using a CSV file. Note that there are templates for how these files must appear in the skule_vote/backend/static/backend/csv_templates
folder of this repo.
Additionally, if you go to the admin site and click on Election Sessions
on the left-hand panel, you will get a page that shows you a list of all the Election Sessions
. On top right this page you will see a button Download CSV Templates
that will serve you a ZIP file of all of the CSV files in the skule_vote/backend/static/backend/csv_templates
directory.
Developer Note: If you wish to change the CSV templates in any way, make sure to regenerate the ZIP file and place it in the skule_vote/backend/static/backend
directory.
To use this method, when you go to the admin
site and add an ElectionSession
you must add an ElectionSession
with a name
, start_date
and end_date
, and CSV files for each section of election
, candidate
and eligibility
. These CSV files have certain constraints that must be obeyed. The constraints are as follows:
- The header (first row) of each CSV file must be the same as the ones in the
/csv_files
templates. - Within a single CSV file all rows must be of equal length (have the same number of comma separated values).
- Election and Eligibility CSVs must have the same number of rows, since they are 1-to-1.
- The Election names in the Eligibilities and Candidates CSVs must match the ones in the Elections CSV.
- Within the Elections CSV:
- All of the
seats_available
must be integers and >=1. - Election Categories must be one of
[Referenda, Officer, Board of Directors, Discipline Club, Class Representative, Other]
.
- All of the
- Within the Eligibilities CSV:
- All of the eligible fields must be integers and either
1 (True)
or0 (False)
. - Eligibilities
status_eligible
fields must be one of[Full Time, Part Time, Full and Part Time]
.
- All of the eligible fields must be integers and either
Note: All the CSV files must be uploaded at once, or none at all. If this is not met then an error will be shown and nothing will happen.
Note: if you upload CSVs successfully and realize you made a mistake, you can just re-upload the updated CSVs to the same ElectionSession
. All of the previous Elections
, Candidates
and Eligibilities
connected to that ElectionSession
will be deleted and new ones will be created from the new CSV.
Note: once an ElectionSession has started you cannot edit it to change its name
, start_date
, or upload any new CSV files. Any changes required for Elections
, Candidates
and Eligibilities
must be made manually. You can change the ElectionSession's
end_date
once it has started, also manually.
To use this method, when you go to the admin
site and add an ElectionSession
you must add an ElectionSession
with only a name
, start_date
and end_date
. You will then go and manually create each of Election
, Candidate
and Eligibility
. Note that Candidate
and Eligibility
require an Election
to connect to, so Elections
should be created first.
The RON/No Candidate
is created by default on the creation of each Election
. It is also deleted by cascade on deletion of any Election
, which includes manual Election
deletion or as a cascade from deleting an ElectionSession
. We describe it as the RON/No Candidate
since it can take the form of a RON Candidate
in the case where there are two or more other Candidates
, or the No Candidate
in the case of a single other Candidate
.
The RON/No Candidate
has a default statement that says Choose this option to reopen nominations.
. This will appear to the user when RON
is active. When No
is active, we remove the message and change the name to No
. This is all done in the frontend.
The RON/No Candidate
is protected from accidental deletion in the following ways:
- When you go to the
Candidate
changelist on the admin site, you will not see anyRON Candidates
when in production more (you will see them in debug mode though). - When you go to the change view for a specific
Candidate
on the admin site, you should not see aDelete
button for anyRON Candidates
, while you can see it for regularCandidates
(you will see them in debug mode though).
Developer Note: If you wish to change any of these options they are found in the backend/models.py
and backend/admin.py
files.