Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bryan BRANCOTTE
django-basetheme-bootstrap
Commits
6fcda825
Commit
6fcda825
authored
Jul 16, 2021
by
Bryan BRANCOTTE
Browse files
preferences managment become user dependant, allows to show settings for only a subset of users
parent
e0b446d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
basetheme_bootstrap/user_preferences_utils.py
View file @
6fcda825
...
...
@@ -88,21 +88,19 @@ class UserPreferencesAbstractModelWithoutUser(models.Model):
self
.
_meta
.
verbose_name
.
title
(),
)
@
classmethod
def
get_allowed_fields
(
cls
):
if
cls
.
preferences_groups
is
not
None
:
for
group
,
fields
in
cls
.
preferences_groups
.
items
():
def
get_allowed_fields
(
self
):
if
self
.
preferences_groups
is
not
None
:
for
group
,
fields
in
self
.
preferences_groups
.
items
():
for
f
in
fields
:
yield
f
return
for
field_name
in
[
f
.
name
for
f
in
cls
.
_meta
.
get_fields
()]:
for
field_name
in
[
f
.
name
for
f
in
self
.
_meta
.
get_fields
()]:
if
field_name
==
"id"
or
field_name
==
"pk"
or
field_name
==
"user"
:
continue
yield
field_name
@
classmethod
@
property
def
preferences_groups
(
cls
):
def
preferences_groups
(
self
):
return
None
@
property
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment