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
af36a9d2
Verified
Commit
af36a9d2
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Use autodiscover code of Django for checks and model extensions
parent
c04d7806
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!293
Use autodiscover code of Django for checks and model extensions
Pipeline
#2463
failed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/apps.py
+4
-0
4 additions, 0 deletions
aleksis/core/apps.py
aleksis/core/util/apps.py
+0
-16
0 additions, 16 deletions
aleksis/core/util/apps.py
with
4 additions
and
16 deletions
aleksis/core/apps.py
+
4
−
0
View file @
af36a9d2
...
...
@@ -2,6 +2,7 @@ from typing import Any, List, Optional, Tuple
import
django.apps
from
django.http
import
HttpRequest
from
django.utils.module_loading
import
autodiscover_modules
from
dynamic_preferences.registries
import
preference_models
...
...
@@ -36,6 +37,9 @@ class CoreConfig(AppConfig):
def
ready
(
self
):
super
().
ready
()
# Autodiscover various modules defined by AlekSIS
autodiscover_modules
(
"
model_extensions
"
,
"
checks
"
)
sitepreferencemodel
=
self
.
get_model
(
"
SitePreferenceModel
"
)
personpreferencemodel
=
self
.
get_model
(
"
PersonPreferenceModel
"
)
grouppreferencemodel
=
self
.
get_model
(
"
GroupPreferenceModel
"
)
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/apps.py
+
0
−
16
View file @
af36a9d2
...
...
@@ -19,15 +19,6 @@ class AppConfig(django.apps.AppConfig):
def
ready
(
self
):
super
().
ready
()
# Run model extension code
try
:
import_module
(
"
.
"
.
join
(
self
.
__class__
.
__module__
.
split
(
"
.
"
)[:
-
1
]
+
[
"
model_extensions
"
])
)
except
ImportError
:
# ImportErrors are non-fatal because model extensions are optional.
pass
# Register default listeners
pre_migrate
.
connect
(
self
.
pre_migrate
,
sender
=
self
)
post_migrate
.
connect
(
self
.
post_migrate
,
sender
=
self
)
...
...
@@ -38,13 +29,6 @@ class AppConfig(django.apps.AppConfig):
# Getting an app ready means it should look at its config once
self
.
preference_updated
(
self
)
# Register system checks of this app
try
:
import_module
(
"
.
"
.
join
(
self
.
__class__
.
__module__
.
split
(
"
.
"
)[:
-
1
]
+
[
"
checks
"
]))
except
ImportError
:
# ImportErrors are non-fatal because checks are optional.
pass
@classmethod
def
get_name
(
cls
):
"""
Get name of application package.
"""
...
...
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