Feat: add Terms of Use update view and middleware #1217
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.
Description
Related issue: #141, #161
It adds a migration for the
ConsentFieldValue
model:accounts.0022_add_created_updated_to_consent
So it requires a
python manage.py migrate
.I have added some methods that handle the consent and session to the model.
configuration in the rdmo-app
When
ACCOUNT_TERMS_OF_USE
is enabled, some settings need to be configured in the rdmo-app as well.In the settings from
local.py
:An optional feature is added that sets the date on which the ToU text is valid, so that it can be easily updated when the text might change. The optional setting is
TERMS_VERSION_DATE
and needs to be a valid date string that is compatible with formats from djangoget_format('DATE_INPUT_FORMATS')
. The date of this setting checks if the user has updated their consent on or after that date, otherwise the consent is invalid and asked to accept again.Optionally, in the
urls.py
:Motivation and Context
How has this been tested?
Screenshots (if appropriate)