Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to nest other component in the component #4

Open
rtpm opened this issue Mar 13, 2024 · 0 comments
Open

Unable to nest other component in the component #4

rtpm opened this issue Mar 13, 2024 · 0 comments

Comments

@rtpm
Copy link

rtpm commented Mar 13, 2024

Hello Sascha, here's a problem I am facing.

Describe the bug
Can't use other djck components in the component

To Reproduce
Say there are 2 components.
{% icon %} -> Inline
{% icon_with_text %} -> block

The first one is a simple svg code. The second one is a div and text below.
Here's the template for the second one.

@register.tag
@register.tag('end_icon_with_text')
@component_block_tag(get_template("components/icon_with_text.html"))
def icon_with_text():
    return {}

icon_with_text.html (simplified)

{% load my_components_tags %}

<div class="flex flex-col">
  <div>{% icon %}</div>
<div>{% render_slot slots.children %}</div>

Usage:
{% icon_with_text %}Here's the text{% endicon_with_text %}

Getting error:
django.template.exceptions.TemplateSyntaxError: Invalid block tag on line 2: 'icon'. Did you forget to register or load this tag?

Both tags are located in the same python my_components_tags.py file.
There are other block/inline components working without any problems. {% icon %} tag alone also renders without problems.

Using the latest 0.5.1 version of djck.

Thanks, if you need more info let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant