Institution feature implementation. #670
Open
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.
Overview
Implemented project institution feature, enabling sites with multiple institutions to easily identify which project belongs to which institution. This feature automates institution assignment based on the PI's email address.
Changes Made
models.py
- Addedinstitution
attribute into theProject
class.core.py
- Added environment variable,PROJECT_INSTITUTION_EMAIL_MAP
.view.py
- Implemented logic intoform_valid
function to handle institution assignment./templates
-project_detail
,project_list
,project_archived_list
altered to showinstitution
from GUI.tests.py
- Tests added forinstitution
feature.config.md
- Added basic documentation to describePROJECT_INSTITUTION_EMAIL_MAP
admin.md
- Overhauledget_list_display
to add multiple dynamic columns intolist_display
, therefore showinginstitution
andproject_code
alongside one another./migrations
- Migration file added./management
- Management commands added to retrospectively assign institution codes to preexisting projects,--dry-run
option included too.Examples*
Feature uses
PROJECT_INSTITUTION_EMAIL_MAP
to check the PIs email address against a dictionary of key-value pairs, set by the user. e.g.PROJECT_INSTITUTION_EMAIL_MAP=cardiff.ac.uk=CDF,bangor.ac.uk=BGR,swansea.ac.uk=SWAN
If PIs email matches a key, the value will be stored into the database.
The screenshots below use a
cardiff.ac.uk
email address and make theCDF
institution available in the GUI.project_list
project_detail
Project Admin Panel