skip to navigation
skip to content

django-model-values 0.4

Taking the O out of ORM.

Package Documentation

Django model utilities for encouraging direct data access instead of unnecessary object overhead. Implemented through compatible method and operator extensions to QuerySets and Managers.

The goal is to provide elegant syntactic support for best practices in using Django’s ORM. Specifically avoiding the inefficiencies and race conditions associated with always using objects.


Typical model usage is verbose, inefficient, and incorrect.

book = Book.objects.get(pk=pk)
book.rating = 5.0

The correct method is generally supported, but arguably less readable.


model_values encourages the better approach with operator support.

Book.objects[pk]['rating'] = 5.0

Similarly for queries:

(book.rating for book in books)
books.values_list('rating', flat=True)

Column-oriented syntax is common in panel data layers, and the greater expressiveness cascades.

books.values_list('rating', flat=True).filter(rating__gt=0)
books['rating'] > 0

To enable, instantiate the custom Manager in your models. See documentation for more examples.


$ pip install django-model-values


  • Django 1.8+
  • Python 2.7, 3.3+


100% branch coverage.

$ py.test [--cov]



  • upsert method
  • django 1.9 database functions
  • bulk_update supports additional fields


  • Lookup methods and operators
  • F expressions and aggregation methods
  • Database functions
  • Conditional expressions for updates and annotations
  • Bulk updates and change detection


  • Change detection
  • Groupby functionality
  • Named tuples
File Type Py Version Uploaded on Size
django-model-values-0.4.tar.gz (md5) Source 2016-04-29 18KB