Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Prevent Django from automatically loading related models

Project description

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

Project details


Release history Release notifications

This version
History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_no_lazy_queries-0.1-py2.py3-none-any.whl (3.2 kB) Copy SHA256 hash SHA256 Wheel py2.py3
django-no-lazy-queries-0.1.tar.gz (1.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page