turbo-django icon indicating copy to clipboard operation
turbo-django copied to clipboard

ModelStream as Mixin?

Open nerdoc opened this issue 2 years ago • 4 comments

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?

nerdoc avatar May 13 '22 22:05 nerdoc

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

scuml avatar May 14 '22 18:05 scuml

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 avatar May 14 '22 18:05 nerdoc

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.

nerdoc avatar May 14 '22 18:05 nerdoc

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.

scuml avatar May 14 '22 18:05 scuml