mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Refactor applications loading.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
"""Core config for admin."""
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
BASE_EVENTS = [
|
||||
"CanCreate",
|
||||
|
||||
"AccountCreated",
|
||||
"AccountAutoCreated",
|
||||
"AccountModified",
|
||||
"AccountDeleted",
|
||||
"AccountExported",
|
||||
"AccountImported",
|
||||
"PasswordUpdated",
|
||||
"ExtraAccountActions",
|
||||
"RoleChanged",
|
||||
"GetExtraRoles",
|
||||
"GetExtraRolePermissions",
|
||||
"PasswordChange",
|
||||
"UserCanSetRole",
|
||||
|
||||
"InitialDataLoaded",
|
||||
|
||||
"UserMenuDisplay",
|
||||
"AdminMenuDisplay",
|
||||
"GetStaticContent",
|
||||
|
||||
"UserLogin",
|
||||
"UserLogout",
|
||||
|
||||
"GetAnnouncement",
|
||||
|
||||
"TopNotifications",
|
||||
"ExtraAdminContent",
|
||||
|
||||
"ExtraUprefsRoutes",
|
||||
"ExtraUprefsJS",
|
||||
|
||||
"GetExtraParameters",
|
||||
"ExtraFormFields",
|
||||
"SaveExtraFormFields",
|
||||
]
|
||||
|
||||
|
||||
def load_core_settings():
|
||||
"""Load core settings.
|
||||
|
||||
This function must be manually called (see :file:`urls.py`) in
|
||||
order to load base settings.
|
||||
"""
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from modoboa.lib import parameters, events
|
||||
from .app_settings import GeneralParametersForm
|
||||
|
||||
parameters.register(GeneralParametersForm, ugettext_lazy("General"))
|
||||
events.declare(BASE_EVENTS)
|
||||
|
||||
|
||||
class CoreConfig(AppConfig):
|
||||
|
||||
"""App configuration."""
|
||||
|
||||
name = "modoboa.core"
|
||||
verbose_name = "Modoboa core"
|
||||
|
||||
def ready(self):
|
||||
load_core_settings()
|
||||
@@ -0,0 +1,31 @@
|
||||
"""App config for limits."""
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
EVENTS = [
|
||||
'GetExtraLimitTemplates'
|
||||
]
|
||||
|
||||
|
||||
def load_limits_settings():
|
||||
"""Load settings."""
|
||||
from django.utils.translation import ugettext as _
|
||||
from modoboa.lib import events, parameters
|
||||
from .app_settings import ParametersForm
|
||||
|
||||
parameters.register(ParametersForm, _("Limits"))
|
||||
events.declare(EVENTS)
|
||||
from . import controls
|
||||
from . import general_callbacks
|
||||
|
||||
|
||||
class LimitsConfig(AppConfig):
|
||||
|
||||
"""App configuration."""
|
||||
|
||||
name = "modoboa.limits"
|
||||
verbose_name = "Modoboa admin limits"
|
||||
|
||||
def ready(self):
|
||||
load_limits_settings()
|
||||
Reference in New Issue
Block a user