Add forms for displaying and gathering consent.
Review Request #9925 — Created May 11, 2018 and submitted
This introduces a new
djblets.privacy.consent.forms
module, which
features fields, widgets, and form mixins for prompting for consent.
Along with the rest of the consent functionality, it's now very easy
for applications to offer users options on how to manage their own
personal data.
ConsentRequirementField
(and its corresponding widget) displays an
informative field for a singleConsentRequirement
. It clearly lists
a summary of the requirement, an optional icon representing it, a
description of the intended usage, and a description of what data would
be sent. Two buttons, "Allow" and "Block," are available to allow usage
of their private data for the feature or to block usage.
MultiConsentRequirementsField
wraps multiple
ConsentRequirementField
s, one for each requirement provided (or one
for each one registered in the registry). This is intended for forms
that want to offer all (or many) options at once.
ConsentFormMixin
can be mixed into other forms, and will construct a
MultiConsentRequirementsField
on initialization. It provides a handful
of methods to override for controlling data going into the field, and a
save_consent()
method to save and record the choices made.
ConsentConfigPageFormMixin
is used for configforms, and provides
default implementations of the methods needed byConsentFormMixin
. It
also automatically handles the saving, and adds a message to display
on the form when saved. This is the easiest way to provide consent
information to users.
Unit tests pass.
Manually and thoroughly tested this form, allowing and blocking
consent for multiple options and testing results. Tested validation
logic and resulting data in the database on success.
-
-
Using general comments because image comments are broken on this deploy:
For the error case, I feel like the error message is hard to see, and it's also probably hard to know immediately which things still need choices.
Can we move the error message next to the "Save" button, and then add some kind of callout for each un-chosen item (maybe bold red arrows next to the allow/block actions)?
-
-
-
-
- Change Summary:
-
- Fixed some doc errors.
- Changed the styling a bit to promote unchosen consent. It now has a goldish background with a box shadow. Selected options no longer have have a box shadow, and the title matches the Allow/Block color.
- Commit:
-
678cf0e6fe0c545598414e92517068f91622d125cdfcfc2cc7adaa635c9ab6d846d18e1edc96a365
- Diff:
-
Revision 2 (+1584)
- Added Files: