Skip to content

Commit 288088b

Browse files
author
Andy Babic
committed
Update render_pattern() to apply context modifiers for the specified template
1 parent b75320e commit 288088b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pattern_library/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from pattern_library import (
1717
get_pattern_context_var_name, get_pattern_template_suffix, get_sections
1818
)
19+
from pattern_library.context_modifiers import registry
1920
from pattern_library.exceptions import TemplateIsNotPattern
2021

2122

@@ -202,6 +203,8 @@ def render_pattern(request, template_name, allow_non_patterns=False):
202203

203204
context = get_pattern_context(template_name)
204205
context[get_pattern_context_var_name()] = True
206+
for modifier in registry.get_for_template(template_name):
207+
modifier(context=context, request=request)
205208
return render_to_string(template_name, request=request, context=context)
206209

207210

0 commit comments

Comments
 (0)