Django model: Database instrumentation

def blocker(*args):
    raise Exception('No database access allowed here.')

A hook for installing wrapper functions around the execution of database queries including can count queries, measure query duration, log queries, or even prevent query execution (e.g. to make sure that no queries are issued while rendering a template with prefetched data).

Related concepts

Django model: Database instrumentation — Structure map

Clickable & Draggable!

Django model: Database instrumentation — Related pages: