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
|
||||
import os
|
||||
import json
|
||||
from jinja2 import ChoiceLoader, FileSystemLoader, PrefixLoader
|
||||
|
||||
# Extensions (définies dans extensions.py)
|
||||
from .extensions import db, login_manager, migrate, csrf
|
||||
|
|
@ -40,6 +41,18 @@ def create_app(config_name='default'):
|
|||
template_folder=template_dir,
|
||||
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
|
||||
app.url_map.strict_slashes = False
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ def detail(id):
|
|||
history = intervention.status_history.order_by(StatusChange.created_at.desc()).all()
|
||||
# Utiliser explicitement le template du module. Une ancienne copie globale
|
||||
# de ``interventions/detail.html`` est conservée pour compatibilité.
|
||||
return render_template('detail.html',
|
||||
return render_template('interventions_module/detail.html',
|
||||
intervention=intervention,
|
||||
statuses=INTERVENTION_STATUSES,
|
||||
transitions=transitions,
|
||||
|
|
|
|||
Loading…
Reference in a new issue