Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
c23f1224
Verified
Commit
c23f1224
authored
4 years ago
by
Nik | Klampfradler
Committed by
Jonathan Weth
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Replace constance in sass helpers and models
parent
bfe78906
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!217
Migrate from constance to dynamic-preferences
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/core/models.py
+6
-4
6 additions, 4 deletions
aleksis/core/models.py
aleksis/core/settings.py
+1
-1
1 addition, 1 deletion
aleksis/core/settings.py
aleksis/core/util/sass_helpers.py
+4
-3
4 additions, 3 deletions
aleksis/core/util/sass_helpers.py
with
11 additions
and
8 deletions
aleksis/core/models.py
+
6
−
4
View file @
c23f1224
...
...
@@ -20,7 +20,9 @@ from .tasks import send_notification
from
.util.core_helpers
import
now_tomorrow
from
.util.model_helpers
import
ICONS
from
constance
import
config
from
dynamic_preferences.registries
import
global_preferences_registry
global_preferences
=
global_preferences_registry
.
manager
()
class
School
(
ExtensibleModel
):
...
...
@@ -176,9 +178,9 @@ class Person(ExtensibleModel):
@property
def
adressing_name
(
self
)
->
str
:
if
config
.
ADRESSING_NAME_FORMAT
==
"
dutch
"
:
if
global_preferences
[
"
notification__addressing_name_format
"
]
==
"
dutch
"
:
return
f
"
{
self
.
last_name
}
{
self
.
first_name
}
"
elif
config
.
ADRESSING_NAME_FORMAT
==
"
english
"
:
elif
global_preferences
[
"
notification__addressing_name_format
"
]
==
"
english
"
:
return
f
"
{
self
.
last_name
}
,
{
self
.
first_name
}
"
else
:
return
f
"
{
self
.
first_name
}
{
self
.
last_name
}
"
...
...
@@ -239,7 +241,7 @@ class Person(ExtensibleModel):
a primary group, unless force is True.
"""
pattern
=
pattern
or
config
.
PRIMARY_GROUP_PATTERN
pattern
=
pattern
or
global_preferences
[
"
account__primary_group_pattern
"
]
if
pattern
:
if
force
or
not
self
.
primary_group
:
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/settings.py
+
1
−
1
View file @
c23f1224
...
...
@@ -318,7 +318,7 @@ SASS_PROCESSOR_ENABLED = True
SASS_PROCESSOR_AUTO_INCLUDE
=
False
SASS_PROCESSOR_CUSTOM_FUNCTIONS
=
{
"
get-colour
"
:
"
aleksis.core.util.sass_helpers.get_colour
"
,
"
get-
config
"
:
"
aleksis.core.util.sass_helpers.get_
config
"
,
"
get-
preference
"
:
"
aleksis.core.util.sass_helpers.get_
preference
"
,
}
SASS_PROCESSOR_INCLUDE_DIRS
=
[
_settings
.
get
(
"
materialize.sass_path
"
,
JS_ROOT
+
"
/materialize-css/sass/
"
),
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/sass_helpers.py
+
4
−
3
View file @
c23f1224
from
django.conf
import
settings
from
colour
import
web2hex
from
constance
import
config
from
dynamic_preferences.registries
import
global_preferences_registry
from
sass
import
SassColor
...
...
@@ -12,5 +12,6 @@ def get_colour(html_colour: str) -> SassColor:
return
SassColor
(
r
,
g
,
b
,
255
)
def
get_config
(
setting
:
str
)
->
str
:
return
getattr
(
config
,
setting
,
""
)
or
getattr
(
settings
,
setting
,
""
)
def
get_preference
(
section
:
str
,
name
:
str
)
->
str
:
global_preferences
=
global_preferences_registry
.
manager
()
return
global_preferences
[
"
%s__%s
"
%
(
section
,
name
)]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment