mirror of
https://github.com/django-components/django-components.git
synced 2025-08-09 16:57:59 +00:00
refactor: fix minor errors
This commit is contained in:
parent
7fbccbf009
commit
390b16f764
2 changed files with 11 additions and 4 deletions
|
@ -22,7 +22,14 @@ from django_components.component_registry import registry # NOQA
|
|||
from django_components.component_registry import AlreadyRegistered, ComponentRegistry, NotRegistered, register # NOQA
|
||||
from django_components.logger import logger
|
||||
from django_components.middleware import is_dependency_middleware_active
|
||||
from django_components.slots import FillContent, FillNode, SlotName, render_component_template_with_slots
|
||||
from django_components.slots import (
|
||||
FillContent,
|
||||
FillNode,
|
||||
SlotName,
|
||||
render_component_template_with_slots,
|
||||
OUTER_CONTEXT_CONTEXT_KEY,
|
||||
DEFAULT_SLOT_KEY,
|
||||
)
|
||||
from django_components.utils import search
|
||||
|
||||
RENDERED_COMMENT_TEMPLATE = "<!-- _RENDERED {name} -->"
|
||||
|
|
|
@ -14,7 +14,7 @@ else:
|
|||
from typing import TypeAlias
|
||||
|
||||
from django.template import Context, Template
|
||||
from django.template.base import FilterExpression, Node, NodeList, Parser, TextNode
|
||||
from django.template.base import FilterExpression, Node, NodeList, TextNode, Parser
|
||||
from django.template.defaulttags import CommentNode
|
||||
from django.template.exceptions import TemplateSyntaxError
|
||||
from django.utils.safestring import SafeString, mark_safe
|
||||
|
@ -143,8 +143,8 @@ class SlotNode(Node, TemplateAwareNodeMixin):
|
|||
elif app_settings.SLOT_CONTEXT_BEHAVIOR == SlotContextBehavior.ISOLATED:
|
||||
return root_ctx
|
||||
elif app_settings.SLOT_CONTEXT_BEHAVIOR == SlotContextBehavior.PREFER_ROOT:
|
||||
new_context = context.__copy__()
|
||||
new_context.push(root_ctx)
|
||||
new_context: Context = context.__copy__()
|
||||
new_context.update(root_ctx)
|
||||
return new_context
|
||||
else:
|
||||
raise ValueError(f"Unknown value for SLOT_CONTEXT_BEHAVIOR: '{app_settings.SLOT_CONTEXT_BEHAVIOR}'")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue