Skip to content

Commit

Permalink
Merge branch 'feature/OPL-83' into mb-83
Browse files Browse the repository at this point in the history
  • Loading branch information
delcroip authored Jun 29, 2023
2 parents f446668 + 07a33fa commit 2e00565
Show file tree
Hide file tree
Showing 7 changed files with 825 additions and 463 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,32 @@ Notes:

## Developer tools

### Adding Django Settings
If modules are using additional libraries that would usually require changes in `settings.py`,
these settings should be added within the module and not directly in assembly.
To do this, `django_settings.py` file with `SETTINGS` variable containing
a list of `SettingAttribute` objects has to be added to module (the same as in assembly module).
`SettingAttribute` provides information regarding setting `name`, setting `value` and conflict `resolving policy`.

#### Example:
```python
# django_settings.py
from openIMIS.modulesettingsloader import SettingsAttribute, SettingsAttributeConflictPolicy as setting_type

SETTINGS = [
SettingAttribute('CUSTOM_REQUIRED_SETTING', {'key': 'value'}, setting_type.MERGE_YIELD)
]
```
Is equivalent of assigning:
```python
# settings.py
CUSTOM_REQUIRED_SETTING = {'key': 'value'}
```
in `settings.py`.

Last parameter is used for resolving conflicts between overlying settings.
By default, values are merged (dictionaries are combined, lists concatenated), and if it's not possible
then already declared settings are not overridden.

### To create backend module skeleton in single command
* from `/openimis-be_py/openIMIS`:
Expand Down
Loading

0 comments on commit 2e00565

Please sign in to comment.