Distinguer le template des interventions
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
This commit is contained in:
parent
213cc15820
commit
256a0f43b7
2 changed files with 14 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ from flask_wtf.csrf import CSRFProtect
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
from jinja2 import ChoiceLoader, FileSystemLoader, PrefixLoader
|
||||||
|
|
||||||
# Extensions (définies dans extensions.py)
|
# Extensions (définies dans extensions.py)
|
||||||
from .extensions import db, login_manager, migrate, csrf
|
from .extensions import db, login_manager, migrate, csrf
|
||||||
|
|
@ -39,6 +40,18 @@ def create_app(config_name='default'):
|
||||||
instance_relative_config=True,
|
instance_relative_config=True,
|
||||||
template_folder=template_dir,
|
template_folder=template_dir,
|
||||||
static_folder=os.path.join(app_dir, 'static'))
|
static_folder=os.path.join(app_dir, 'static'))
|
||||||
|
|
||||||
|
# Les modules historiques contiennent plusieurs templates portant le même
|
||||||
|
# nom (notamment ``detail.html``). Ce préfixe garantit que la fiche
|
||||||
|
# intervention charge toujours le template du bon module.
|
||||||
|
app.jinja_loader = ChoiceLoader([
|
||||||
|
app.jinja_loader,
|
||||||
|
PrefixLoader({
|
||||||
|
'interventions_module': FileSystemLoader(
|
||||||
|
os.path.join(app_dir, 'interventions', 'templates')
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
|
||||||
# Tolerer les slashs finaux dans les URLs
|
# Tolerer les slashs finaux dans les URLs
|
||||||
app.url_map.strict_slashes = False
|
app.url_map.strict_slashes = False
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ def detail(id):
|
||||||
history = intervention.status_history.order_by(StatusChange.created_at.desc()).all()
|
history = intervention.status_history.order_by(StatusChange.created_at.desc()).all()
|
||||||
# Utiliser explicitement le template du module. Une ancienne copie globale
|
# Utiliser explicitement le template du module. Une ancienne copie globale
|
||||||
# de ``interventions/detail.html`` est conservée pour compatibilité.
|
# de ``interventions/detail.html`` est conservée pour compatibilité.
|
||||||
return render_template('detail.html',
|
return render_template('interventions_module/detail.html',
|
||||||
intervention=intervention,
|
intervention=intervention,
|
||||||
statuses=INTERVENTION_STATUSES,
|
statuses=INTERVENTION_STATUSES,
|
||||||
transitions=transitions,
|
transitions=transitions,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue