Django Templates 6.0
Last reviewed Oct 28, 2026
Prompt Details
Prompt Composition
3prompts
- Python 3155 lines · 3.8K tokens
- Django 6.0110 lines · 4.1K tokens
- Django Templates 6.055 lines · 2.5K tokens
Total320 lines · 10.4K tokens
CWE Coverage
- 20
- 23
- 36
- 59
- 73
- 78
- 79
- 89
- 95
- 117
- 201
- 203
- 208
- 209
- 214
- 250
- 287
- 295
- 307
- 319
- 328
- 338
- 347
- 352
- 367
- 379
- 384
- 409
- 416
- 426
- 427
- 434
- 470
- 488
- 502
- 521
- 524
- 532
- 550
- 598
- 601
- 611
- 614
- 639
- 640
- 674
- 732
- 770
- 772
- 776
- 778
- 798
- 807
- 829
- 862
- 915
- 916
- 918
- 942
- 1004
- 1021
- 1104
- 1275
- 1333
- 1336
- 1395
Prompt Preview
Apply python/django/6.0 first. These additional rules cover the Django Template Language (DTL) shipped with Django 6.0.8, including template partials, on supported Python 3.12–3.14 micro releases. Stay on the latest security patch in the 6.0 line.
Template loading and partials
- Keep
TEMPLATESentries,DIRS,APP_DIRS,OPTIONS["loaders"], and installed application templates under trusted deployment control. Review loader andINSTALLED_APPSprecedence when names collide; pass an explicit engine name throughusingwhen selecting among engines with different trust or escaping policies. - Preserve path containment when implementing custom filesystem loaders. Django's filesystem loader uses
safe_join(), which checks normalized paths without resolving symlinks; prevent untrusted writes to template roots, their ancestors, and symlink targets rather than treating a configured root as a filesystem sandbox. - Map external display choices to server-owned template names before calling
get_template(),select_template(),{% include %}, or{% extends %}. Allowlist the completepage.html#partial_nametarget and every fallback candidate; include targets can also be objects withrender(), so accept those only from trusted application code. - Authorize and scope data independently in views that render
page.html#partial_name. Loading a partial renders that fragment without the surrounding page's conditions or layout; a permission check around its original definition or use does not protect a separate fragment endpoint. - Give reusable includes only their