You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RuntimeError: Template error: Unsupported template tag '{% cotton button %}'.
Register a handler via djust._rust.register_tag_handler(), or use Django's template engine instead.
My first idea was to make cotton finish its work earlier, so djust would only receive plain HTML. But cotton renders its components at runtime instead of expanding them up front, so I do not think that is possible.
What I tried
The error message suggested registering a handler, so I wrote a small one that passes the tag back to Django's engine:
It works. Components show up on the first page load and on WebSocket updates, values from the view appear inside components, and updates still look small (I only see SetText patches, even for text inside a component).
My questions
Is register_block_tag_handler meant to be used this way, or only for handlers that build the HTML themselves?
Is there a plan for third-party Django tag libraries to work with the Rust engine, or is writing a handler like this the expected way?
Since the component is rendered by Django's engine, I assume I lose the Rust speed for that part. Is there a better way?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi, I am new to djust and I want to check if my approach makes sense before we build on it.
We would like to use djust together with django-cotton.
The problem
Cotton turns this:
into this:
Then djust stops with:
My first idea was to make cotton finish its work earlier, so djust would only receive plain HTML. But cotton renders its components at runtime instead of expanding them up front, so I do not think that is possible.
What I tried
The error message suggested registering a handler, so I wrote a small one that passes the tag back to Django's engine:
I register it once in
AppConfig.ready().It works. Components show up on the first page load and on WebSocket updates, values from the view appear inside components, and updates still look small (I only see
SetTextpatches, even for text inside a component).My questions
register_block_tag_handlermeant to be used this way, or only for handlers that build the HTML themselves?Thanks for any guidance.
All reactions