Simplify TemplateHook and create a mixin for applies_to functionality.
Review Request #5371 — Created Jan. 31, 2014 and submitted — Latest diff uploaded
TemplateHook
did some hard work in order to figure out the URL name to
match forapplies_to
. Turns out that Django provides the URL name for
us, throughrequest.resolver_match.url_name
. Since this is more
reliable, we can use this directly.The
applies_to
support is pretty handy, and even though it's now
simpler, it's best not to have to re-implement it. This change pulls it
out into a mixin that can be easily used by other hooks.
Unit tests pass.