Refactor settings (mostly)#117
Open
chrisarridge wants to merge 15 commits into
Open
Conversation
This commit starts the process of refactoring the settings file so that it does not contain data and constants, but just settings information. This will also involve refactoring other files to access settings with django.conf.settings rather than a direct import which is not best practice.
This commit moves the generation of a list of timezones and other choice fields, such as user roles and reporting source types, from settings into constants.
Codelists and licences are currently loaded by settings.py and accessed from there, but this is not best practice. This commit refactors settings.py to move these constant pieces of data into constants.py. We anticipate handling these codelist values separately in the future, e.g., via a periodic refresh from a separate SSOT and storage in the database, but for now this cleans up settings.
This commit removes the environment variables used to set the names of the codelist files. These are essentially fixed and so this change reduces complexity in the environment variables.
This commit fixes a small bug where Superadmin could be selected as a valid role to change an organisation user to in the list of organisation users.
simon-20
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR (mainly) contains a refactoring of the settings for IATI Account. This aims to achieve two things, and make a start on a third:
django.conf.settingswhereas the current implementation imports iati_account_web.settings quite liberally. In addition, theenvobject is imported quite liberally to fetch settings directly from the environment variables, rather than relying on "unpacking" these variables insettings.py. This PR addresses this by unpacking the variables and changing the code to get settings fromdjango.conf.settings.settings.pycontains a mix of pure settings and constant data, which is not best practice. This PR moves the data into a separateconstant.pymodule. This is also a step towards fetching codelist and licences from an external SSOT.A small bug was also caught as part of testing this refactoring and fixed while in the neighbourhood.
There are a significant number of commits, some of them are bigger and establish the pattern for the refactoring, others are relatively small. I recommend going through commit-by-commit.