Feature comparison with django-slippers #485
Replies: 2 comments 5 replies
-
I'm not that familiar with So you'd be able to do something like (copying the example verbatim from the essay): <html>
<body>
<div hx-target="this">
#fragment archive-ui
#if contact.archived
<button hx-patch="/contacts/${contact.id}/unarchive">Unarchive</button>
#else
<button hx-delete="/contacts/${contact.id}">Archive</button>
#end
#end
</div>
<h3>Contact</h3>
<p>${contact.email}</p>
</body>
</html> And then you can either render the full "component": Contact c = getContact();
ChillTemplates.render("/contacts/detail.html", "contact", c); Or only that "fragment": Contact c = getContact();
ChillTemplates.render("/contacts/detail.html#archive-ui", "contact", c); In |
Beta Was this translation helpful? Give feedback.
-
Are we sure that we need feature parity? I'm a bit worried we will add features that no one using the library really wants... |
Beta Was this translation helpful? Give feedback.
-
As I was looking for inspiration for some features, I had a look at django-slippers and django-web-components, and compared the features provided by those libraries.
Here I'm documenting django-slippers features that are either 1) significantly diffrent from django-components, or 2) could be discussed/considered for django-components.
As you can see below, I marked all features as "resolved", meaning that I don't think there's much to consider here. But feel free to comment if you disagree or if I've missed something.
registry.register("my_comp", Comp)
. With django-component's you can do the same by importing the component classes inapps.py
. Plus django-components has autodiscovery.So IMO not much to consider here.
Also implemented in django-web-components, so marking as resolved and instead consider this feature in comparison with
django-web-components
.{% endcomponent %}
in{% component "comp_name" %}{% endcomponent %}
. This could be possibly revisited.If so, however, I suggest to see instead the implementation of django-web-components, which is more thorough, so marking as resolved and instead consider this feature in comparison with
django-web-components
.{% my_comp %}{% endmy_comp %}
. I like the idea because IMO it's clearer to read.But I prefer much more the approach taken by
django-web-components
, where one can configure how to render the component tags. So users could decide if they want{% component "my_comp" %}{% endcomponent %}
or
{% my_comp %}{% endmy_comp %}
or something else. So marking as resolved and instead consider this feature in comparison with
django-web-components
.django-web-components
.{% var %}
tagget_context_data
method{% fragment %}
tagAnd again this tag is needed in Slippers to some extend, because it misses a way to execute Python code per component.
Instead, if we need to render some component and then pass the rendered content into another component, we can do in Python, so marking this as resolved.
{% match %}
tagget_context_data
, so marking this as resolved.Beta Was this translation helpful? Give feedback.
All reactions