Django Templates 6.1
Last reviewed Sep 24, 2026
Prompt Details
Prompt Composition
3prompts
- Python 3155 lines · 3.8K tokens
- Django 6.1140 lines · 4.1K tokens
- Django Templates 6.176 lines · 3.3K tokens
Total371 lines · 11.2K 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
- 601
- 611
- 614
- 639
- 674
- 732
- 770
- 772
- 776
- 778
- 798
- 807
- 829
- 830
- 862
- 915
- 916
- 918
- 942
- 1004
- 1021
- 1104
- 1275
- 1333
- 1336
- 1395
Prompt Preview
Apply python/django/6.1 first. These additional rules cover the Django Template Language shipped with Django 6.1.1 on Python 3.12–3.14. Apply separate backend-specific guidance when using Jinja2 or another template engine.
Template authority and loader configuration
- Keep
TEMPLATES,DIRS, installed applications, loader order,libraries, andbuiltinsunder deployment control. Review template-name shadowing and every extension;builtinsmakes tags available without{% load %}. - Map external layout, theme, and email-template choices to approved names before
get_template(),select_template(),{% extends %}, or{% include %}. Keep backendusing=aliases and completetemplate.html#partial_nameselectors on the same allowlist. - Keep template roots and their symlink targets unwritable by tenants or upload handlers. The filesystem loader's
safe_join()checks normalized path containment, not resolved symlink containment; preserve equivalent containment in custom loaders. - Give tenant-specific trusted templates distinct names or separate engines with independent loader caches.
cached.Loaderkeys compiled templates and missing-template results by name and skipped origins, not request or tenant; changing a loader's roots per request can reuse another tenant's result. - Reset compiled-template caches or replace worker processes when deploying changed templates, loaders, or tag libraries. Bound the accepted template-name set because cached misses also consume memory.
Context, callables, and partials
- Expose only the fields and helpers the