Comments (4)
I'd love to read your conclusion about the different frameworks you tried.
Oh yes, and how I tried...
Sockpuppet:
Pros:
- clean, component based setup
- very interesting technology, channels/websockets & morphdom
- friendly community
- good documentation
Cons:
- complicated setup
- buggy
- not possible to piggy-back code, like HTMX'
oob-swap
s - albeit community is friendly, sometimes not helpful for beginners, as they expect advanced knowledge.
Django-Unicorn
Pros:
- extremely good integrated into Django
- clean, component based setup
- very clean setup and encapsulation
- very friendly community
- very good documentation
Cons:
- slow. Just clicking on a counter repeatedly and fast overwhelms the ajax requests.
oob-swap
s not possible. Only changeable things are inside the element/component.- buggy when you try to swap element that has the focus.
Reactor
Pros:
- cool technology: channels, server-side-push & sync
- easy setup
- clean, component based setup
Cons:
- not well maintained, used by almost nobody besides the author (somewhere?)
- almost no documentation
djhtmx
(same author as Reactor)
Pros:
- nice idea: components using HTMX
Cons:
- badly maintained
- bad documentation
turbo-django
A channels using streaming library which adds push messaging possibilities to Django. <turbo-frame>
s are like Unicorn components that capture links inside them and reload only the frame, not the whole page.
Pros:
- well-designed API, albeit a bit abstract and sometimes complicated to understand
- more or less good documentation, but could be better
- event driven programming possible: react on Django model updates -> push HTML to client -> update DOM.
Cons:
- Only links and forms can send events to the server, unlike HTMX, where every HTML tag has this possibility. So you can't implement things like "click on that div" without using other Js frameworks.
<turbo-frame>
s are not backend components with methods, no encapsulation like in Unicorn. You have to use normal views.
django-htmx / HTMX
Pros:
- really versatile and mighty tool
- easily to start with django-htmx by @adamchainz
- killer feature
oob-swap
- faaaast...
Cons:
- when using Django, poor support for "djangonish" thinking, no components, no support for Python objects (like in Unicorn)
- needs boilerplate code in every component you create, few DRY possibilities
- somehow encourages you to produce spaghetti code
So my conclusion is: I'll probably stay with HTMX, and try to not let my weaker self produce too much spaghetti code.
If there was a fairy with one wish: Why the heck did nobody yet create a django component library like Unicorn, based on HTMX?
This would be the best of all worlds:
- Components using Django's template language (like Unicorn, Sockpuppet)
- Python side components with methods that can be called by the frontend (like Unicorn, Sockpuppet)
- HTMX or Turbo for interaction (existing technology)
- additionally
oob-swap
s - you need that for e.g. messaging, or just updating other DOM elements when sending HTML over the wire
So if Unicorn components would u
ideally additionally:
- something like eventstream, turbo-django etc to get server-side messages onto the user's screen as push notification. This would even replace
oob-swap
s. se turbo-django's background technology, everything would be perfect.
Sorry, just woke up from a dream...
from django-htmx-modal-form.
Hi @nerdoc,
I don't have a definitive answer on event naming, and I'm still experimenting with my projects.
For example, here, I used only one event moveListChanged
, but I could have used three events movieAdded
, movieUpdated
, and movieDeleted
.
My intuition tells me that the three events are better, but in practice, I could not find any advantage; that's why I decided to use the simplest solution in the video.
However, I would never use a generic name, like listChanged
, because my pages often contain multiple lists.
Best regards,
Benoit
from django-htmx-modal-form.
Ok, so events in this case would be page specific - or topic-specific.
I just ask because - I've been through Django-unicorn, django-sockpuppet, eventstream, turbo-django, reactor, djhtmx, and many others, tried them all. They all have flaws and weaknesses, and in the end I stayed with HTMX (and django-htmx for convenience).
But I really don't understand why noone hasn't created a high-level framework (like Unicorn) using HTMX, this would be really great. everything is there, the pieces just have to be put together.
And your ideas here are a really great milestone for such a framework.
BTW, a generic name like listChanged
could have the list id as payload. It's just a design question. Would have the advantage to build the HX-Trigger header into generic Mixins (which I tried around a bit with yesterday).
from django-htmx-modal-form.
I'd love to read your conclusion about the different frameworks you tried.
I knew about some of them but never had the opportunity to try them.
Frameworks are better implemented in new projects because they are often difficult to fit existing projects.
That's why I prefer relying on HTMX as a library: it allows me to enhance my application progressively.
I'm really satisfied with the Django+HTMX combo. I only miss support for dependent/cascaded fields at the Form level. I made it work by creating custom form mixins, but I wish I could use a less hacky solution.
from django-htmx-modal-form.
Related Issues (10)
- Link going to the wrong page HOT 1
- widget_tweaks was not found when installing HOT 2
- modal.hide & oob content HOT 1
- Form validation error HOT 5
- Tailwind CSS and Alpine.js version of this example HOT 2
- Bootstrap CSS and Jquery version HOT 1
- showMessage event more generic HOT 4
- Uncaught ReferenceError: bootstrap is not defined
- Edit Button not firing up the modal HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-htmx-modal-form.