mirror of
https://github.com/django-components/django-components.git
synced 2025-08-09 00:37:59 +00:00
fix: do NOT render component tags when parsing {% component %} body for fills (#778)
* refactor: do NOT render component tags when parsing {% component %} body for fills * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor: fix typo --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
4d5fecf3ee
commit
f5fd3c02cd
5 changed files with 80 additions and 6 deletions
|
@ -57,6 +57,7 @@ from django_components.slots import (
|
|||
SlotName,
|
||||
SlotRef,
|
||||
SlotResult,
|
||||
_is_extracting_fill,
|
||||
_nodelist_to_slot_render_func,
|
||||
resolve_fills,
|
||||
)
|
||||
|
@ -894,6 +895,11 @@ class ComponentNode(BaseNode):
|
|||
def render(self, context: Context) -> str:
|
||||
trace_msg("RENDR", "COMP", self.name, self.node_id)
|
||||
|
||||
# Do not render nested `{% component %}` tags in other `{% component %}` tags
|
||||
# at the stage when we are determining if the latter has named fills or not.
|
||||
if _is_extracting_fill(context):
|
||||
return ""
|
||||
|
||||
component_cls: Type[Component] = self.registry.get(self.name)
|
||||
|
||||
# Resolve FilterExpressions and Variables that were passed as args to the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue