-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[change] Metric collection: added consent logic to admin UI #372
* Added info message to admin UI (only once and only for super users) * Added a consent form to openwisp-info page * Changed app name from "openwisp_utils.measurements" to "openwisp_utils.metric_collection" * Refactored code to reduce verbosity Closes #372 --------- Co-authored-by: Federico Capoano <[email protected]>
- Loading branch information
1 parent
95c8e9a
commit 1d3b00c
Showing
26 changed files
with
689 additions
and
256 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
10 changes: 10 additions & 0 deletions
10
openwisp_utils/admin_theme/static/admin/css/openwisp-info.css
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#id_user_consented { | ||
float: left; | ||
margin-right: 8px; | ||
vertical-align: top; | ||
margin-bottom: 0px; | ||
} | ||
#id_metric_collection_consent_form > span.helptext{ | ||
display: block; | ||
margin-top: 8px; | ||
} |
This file contains 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
This file contains 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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from django import forms | ||
from django.forms.utils import ErrorList | ||
|
||
from .models import Consent | ||
|
||
|
||
class ConsentForm(forms.ModelForm): | ||
# This required to override the default label_suffix. | ||
# Otherwise, it will show a trailing colon (:) which we | ||
# don't want here due to formatting of the form. | ||
def __init__( | ||
self, | ||
data=None, | ||
files=None, | ||
auto_id="id_%s", | ||
prefix=None, | ||
initial=None, | ||
error_class=ErrorList, | ||
label_suffix='', | ||
empty_permitted=False, | ||
instance=None, | ||
use_required_attribute=None, | ||
renderer=None, | ||
): | ||
super().__init__( | ||
data, | ||
files, | ||
auto_id, | ||
prefix, | ||
initial, | ||
error_class, | ||
label_suffix, | ||
empty_permitted, | ||
instance, | ||
use_required_attribute, | ||
renderer, | ||
) | ||
|
||
class Meta: | ||
model = Consent | ||
widgets = {'user_consented': forms.CheckboxInput(attrs={'class': 'bold'})} | ||
fields = ['user_consented'] |
Oops, something went wrong.