adamchainz / django-htmx

Extensions for using Django with htmx.
https://django-htmx.readthedocs.io/
MIT License
1.57k stars 140 forks source link

New feature pre pull request discussion #81

Closed yelluw closed 3 years ago

yelluw commented 3 years ago

Hello,

I'm using the project and have identified some (IMO) nice additions around mixins and views.

https://github.com/Tiny-Tiny-App/django-htmx/blob/htmx-views-and-mixins/src/django_htmx/mixins.py

https://github.com/Tiny-Tiny-App/django-htmx/blob/htmx-views-and-mixins/src/django_htmx/views.py

Are these additions that fall in line with the project goals?

I'm in the process of writing tests but dont have a clear idea of how y'all are setting up the testing infrastructure.

Could you be so kind and add information to the readme (well here as well) about how to run and add tests to this repo?

adamchainz commented 3 years ago

Hi

Because the classes are so small, I'm very hesitant to add them, and maintain them. I intend the library to mostly consist of low level tools for working with htmx - much like htmx itself is mostly low level primitives. It's not clear to me that partial rendering is even that useful as a technique, since one can use hx-select.

On top of that I'm not a big fan of class based views, I think they're normally a poor trade off. At least the class hierarchy in Django itself is too complicated. To this end I maintain Django-vanilla-views. But that's another rant.

Anyway, to conclude, at this time, I'm not that interested in adding a couple of short view classes, and particularly maintaining them. I think the partial rendering example is enough for users to get started with and build upon.

Thanks for the idea though.

yelluw commented 3 years ago

Ok I understand :)

Wasn't aware of Django-vanilla-views. Thanks for the friendly discussion!

adamchainz commented 3 years ago

No worries, any time. Good luck using htmx.