Django Templates 6.0

Last reviewed Oct 28, 2026

Export as PDF

Prompt Details

Prompt Composition

3prompts
  1. Python 3155 lines · 3.8K tokens
  2. Django 6.0110 lines · 4.1K tokens
  3. 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 TEMPLATES entries, DIRS, APP_DIRS, OPTIONS["loaders"], and installed application templates under trusted deployment control. Review loader and INSTALLED_APPS precedence when names collide; pass an explicit engine name through using when 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 complete page.html#partial_name target and every fallback candidate; include targets can also be objects with render(), 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