File tree Expand file tree Collapse file tree
src/reactpy_django/templatetags Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # Copyright © 2023 Innovatie Ltd. All rights reserved.
21"""
32Jinja support.
43"""
54from django .template import RequestContext , loader
65from jinja2 import pass_context
76from jinja2 .ext import Extension
87from jinja2 .runtime import Context
9- from reactpy_django import config
10- from reactpy_django .templatetags .reactpy import component
11-
12- #
13- # Point to our non-Django analogue.
14- #
15- DJT_TEMPLATE = "reactpy/component.html"
8+ from reactpy_django .templatetags .reactpy import COMPONENT_TEMPLATE , component
169
1710
1811class ReactPyExtension (Extension ):
@@ -62,5 +55,5 @@ def template_tag(
6255 # TODO: can this be usefully cached?
6356 #
6457 return loader .render_to_string (
65- DJT_TEMPLATE , template_context , jinja_context .parent ["request" ]
58+ COMPONENT_TEMPLATE , template_context , jinja_context .parent ["request" ]
6659 )
Original file line number Diff line number Diff line change 2727 RESOLVED_WEB_MODULES_PATH = reverse ("reactpy:web_modules" , args = ["/" ]).strip ("/" )
2828except NoReverseMatch :
2929 RESOLVED_WEB_MODULES_PATH = ""
30+ COMPONENT_TEMPLATE = "reactpy/component.html"
3031register = template .Library ()
3132_logger = getLogger (__name__ )
3233
3334
34- @register .inclusion_tag ("reactpy/component.html" , takes_context = True )
35+ @register .inclusion_tag (COMPONENT_TEMPLATE , takes_context = True )
3536def component (
3637 context : template .RequestContext ,
3738 dotted_path : str ,
You can’t perform that action at this time.
0 commit comments