4 ms·
There is django-zen-queries[0], mentioned in another comment. [0] https://github.com/dabapps/django-zen-queries https://github.com/dabapps/django-zen-queries
by Flimm 4y ago
There is django-zen-queries[0], mentioned in another comment.
[0] https://github.com/dabapps/django-zen-queries https://github.com/dabapps/django-zen-queries
- irjustin 4y agoNot a fan of this one since it only works on templates and requires special code
- Suor 4y agoNever used this, but I see that it provides a context manager/decorator, which you can use to "shield" any code. And also some shortcuts for DjangoREST or something. Regarding extra code, you can simply replace the Djangos' `render()`, with the one from this lib and you are done. I would have probably made a custom template extension or something to do that for all renders automatically though too.
- irjustin 4y agoYeah I really dislike that. It's putting a code path that will never run in production. This feels like code that has special switch `if env.is_test` just because you needed that for a spec. It's a really bad practice. This library sticks that code _everywhere_. The library should be loaded only in local/dev env. Arguably, it shouldn't even be loaded in test. But because of it's style, it needs to be loaded in prod.