We Vote's API application server written in Django/Python. Election data pulled from many sources, used by https://github.com/wevote/WebApp and https://github.com/wevote/WeVoteCordova and https://github.com/wevote/Campaigns.
implemented control flow statements for all read operations in polling_location so that the 'readonly' db is utilized
There are a few other items that I noted that may need further review/second opinion:
should we consider name change for update_polling_location_with_log_counts? To me, the 'update' implies that it's a CRUD action, but the method only reads from db and outputs a dictionary
in polling_location.models.py, is the retrieve_polling_location_by_we_vote_id method redundant?
is there a cleaner way to do the control flow? eg:
def get_queryset(model, read_only=True):
if read_only:
return model.objects.using('readonly').all()
else:
return model.objects.all()
or possibly using DATABASE_ROUTES provided by django
implemented control flow statements for all read operations in polling_location so that the 'readonly' db is utilized
There are a few other items that I noted that may need further review/second opinion:
update_polling_location_with_log_counts
? To me, the 'update' implies that it's a CRUD action, but the method only reads from db and outputs a dictionarypolling_location.models.py
, is theretrieve_polling_location_by_we_vote_id
method redundant?or possibly using DATABASE_ROUTES provided by django