8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 23:43:47 +00:00

Separation des lists d'apps optionnelles pour eviter les erreurs d'import d'urls non présents

This commit is contained in:
Grizzly 2019-08-11 19:51:31 +00:00 committed by root
parent a0dcda6975
commit 3a5fad0287
6 changed files with 14 additions and 11 deletions

View file

@ -41,7 +41,7 @@ from django.utils.translation import ugettext as _
from reversion import revisions as reversion
from importlib import import_module
from re2o.settings_local import OPTIONNAL_APPS
from re2o.settings_local import OPTIONNAL_APPS_RE2O
from re2o.views import form
from re2o.acl import can_create, can_edit, can_delete_set, can_view_all, can_delete
@ -97,7 +97,7 @@ def display_options(request):
cotisationsoptions, _created = CotisationsOption.objects.get_or_create()
document_template_list = DocumentTemplate.objects.order_by('name')
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS]
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS_RE2O]
optionnal_templates_list = [app.views.preferences(request) for app in optionnal_apps]
return form({

View file

@ -30,7 +30,7 @@ from django.http import HttpRequest
from preferences.models import GeneralOption, OptionalMachine
from django.utils.translation import get_language
from importlib import import_module
from re2o.settings_local import OPTIONNAL_APPS
from re2o.settings_local import OPTIONNAL_APPS_RE2O
def context_user(request):
"""Fonction de context lorsqu'un user est logué (ou non),
@ -61,7 +61,7 @@ def context_user(request):
def context_optionnal_apps(request):
"""Fonction de context pour générer la navbar en fonction des
apps optionnels"""
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS]
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS_RE2O]
optionnal_templates_navbar_user_list = [app.views.navbar_user(request) for app in optionnal_apps]
optionnal_templates_navbar_logout_list = [app.views.navbar_logout(request) for app in optionnal_apps]
return {'optionnal_templates_navbar_user_list':optionnal_templates_navbar_user_list,

View file

@ -108,5 +108,8 @@ GID_RANGES = {
'posix': [501, 600],
}
# Some optionnal Re2o Apps
OPTIONNAL_APPS_RE2O = ()
# Some Django apps you want to add in you local project
OPTIONNAL_APPS = ()
OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + ()

View file

@ -49,7 +49,7 @@ from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from django.views.generic import RedirectView
from .settings_local import OPTIONNAL_APPS
from .settings_local import OPTIONNAL_APPS_RE2O
from .views import index, about_page, contact_page
@ -87,7 +87,7 @@ urlpatterns = [
]
urlpatterns += [url(r'^{}/'.format(app), include('{}.urls'.format(app), namespace=app)) for app in OPTIONNAL_APPS]
urlpatterns += [url(r'^{}/'.format(app), include('{}.urls'.format(app), namespace=app)) for app in OPTIONNAL_APPS_RE2O]
# Add debug_toolbar URLs if activated
if 'debug_toolbar' in settings.INSTALLED_APPS:

View file

@ -44,7 +44,7 @@ from preferences.models import (
from .contributors import CONTRIBUTORS
from importlib import import_module
from re2o.settings_local import OPTIONNAL_APPS
from re2o.settings_local import OPTIONNAL_APPS_RE2O
def form(ctx, template, request):
@ -115,7 +115,7 @@ def contact_page(request):
"""
address = MailContact.objects.all()
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS]
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS_RE2O]
optionnal_templates_contact_list = [app.views.contact(request) for app in optionnal_apps]
return render(

View file

@ -57,7 +57,7 @@ from machines.models import Machine
from preferences.models import OptionalUser, GeneralOption, AssoOption
from importlib import import_module
from re2o.settings_local import OPTIONNAL_APPS
from re2o.settings_local import OPTIONNAL_APPS_RE2O
from re2o.views import form
from re2o.utils import (
all_has_access,
@ -979,7 +979,7 @@ def profil(request, users, **_kwargs):
SortTable.MACHINES_INDEX
)
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS]
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS_RE2O]
optionnal_templates_list = [app.views.profil(request,users) for app in optionnal_apps]
pagination_large_number = GeneralOption.get_cached_value(