﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36728	Validate template tag context argument at definition time, rather than compile time	Jake Howard	Jake Howard	"If a template tag is defined incorrectly, by not accepting a `context` argument with `takes_context=True`:

{{{#!python
@register.simple_tag(takes_context=True)
def my_tag():
    pass
}}}

An error is only raised when the template is compiled, rather than when the tag is defined as someone may expect. This means there’s extra work done at compile time, which is duplicated each time the tag is used, across multiple templates.

Moving this validation to be done at definition time would likely improve performance. Reading the function signature is already done at definition time, so the performance improvement will likely only be checking the list of arguments, but reporting the error earlier would probably also be a DX improvement.

See also [https://forum.djangoproject.com/t/validate-template-tag-context-argument-at-definition-time-rather-than-compile-time/42553 forum thread]."	Cleanup/optimization	closed	Template system	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
