hotwire-django / turbo-django

Unmaintained // An early stage integration of Hotwire Turbo with Django
https://discuss.hotwire.dev/t/django-backend-support-for-hotwire/1570/
Other
385 stars 20 forks source link

ModelStream as Mixin? #60

Open nerdoc opened 2 years ago

nerdoc commented 2 years ago

I do not get the full purposes of ModelStream and Component, docs are not fully comprehensive for me here. If I understand correctly, you can add a Meta class to any Stream (even Component?) with a model attribute, and Turbo will connect pre_save/_delete etc. signals to that model.

Then why do you have a ModelStream class to inherit from?

Wouldn't it be possible to implement ModelStream as Mixin? So you can add it to a Component too?

Or am I thinking wrong here?

scuml commented 2 years ago

You make good points. Let me mull that over. Thanks.

nerdoc commented 2 years ago

Thanks. I've searched for years for such a project. Already experimented with sockpuppet, HTMX, unpoly, Unicorn, alpine.js and some others. And turbo-django is definitely the best, hands down. Really great software, very clean design. IMHO just lacks some documentation for newcomers (it assumes a bit too much knowledge; =steep learning courve), and some helpers for often needed (CRUD) tasks. But, with my full respect, this project is really cool. Greetings from Salzburg.

nerdoc commented 2 years ago

You make good points. Let me mull that over. Thanks.

Ah, and: You could even keep the ModelStream classes.

class ModelStreamMixin:
    ...

class ModelStream(ModelStreamMixin, Stream):
    pass

class ModelStreamComponent(ModelStreamMixin, BaseComponent):
    pass

Maybe you find better names.

scuml commented 2 years ago

I'm coming from a similar place. I think this tech has extraordinary potential, just needs some polish and as you mentioned, clear documentation and examples. I'll keep chipping away at it, and hopefully the community will join in help sell more people on this project.