Skip to content

Commit 3f56d4e

Browse files
committed
Address copyright, and use of constant to locate template.
1 parent d888b4d commit 3f56d4e

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

src/reactpy_django/templatetags/jinja.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
# Copyright © 2023 Innovatie Ltd. All rights reserved.
21
"""
32
Jinja support.
43
"""
54
from django.template import RequestContext, loader
65
from jinja2 import pass_context
76
from jinja2.ext import Extension
87
from 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

1811
class 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
)

src/reactpy_django/templatetags/reactpy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
RESOLVED_WEB_MODULES_PATH = reverse("reactpy:web_modules", args=["/"]).strip("/")
2828
except NoReverseMatch:
2929
RESOLVED_WEB_MODULES_PATH = ""
30+
COMPONENT_TEMPLATE = "reactpy/component.html"
3031
register = 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)
3536
def component(
3637
context: template.RequestContext,
3738
dotted_path: str,

0 commit comments

Comments
 (0)