django-no-lazy-queries

Prevent Django from automatically loading related models


License
Other
Install
pip install django-no-lazy-queries==0.1

Documentation

A decorator to help remind you to use select_related.

Only use this while in development. Leaving it in production is a bad idea.

from nolazyqueries import no_lazy_queries

@no_lazy_queries()
def some_view(request):

    # Will raise an exception
    Foo.objects.first().bar

    # Will not raise an exception
    Foo.objects.select_related('bar').first().bar