Skip to main content

Taking the O out of ORM.

Project description

About django-model-values

https://img.shields.io/pypi/v/django-model-values.svg https://img.shields.io/pypi/pyversions/django-model-values.svg https://img.shields.io/pypi/status/django-model-values.svg https://img.shields.io/travis/coady/django-model-values.svg https://img.shields.io/codecov/c/github/coady/django-model-values.svg

Provides 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.

Usage

Do you want readability, …

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

efficiency, correctness, …

Book.objects.filter(pk=pk).update(rating=5.0)

Choose all 3

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

Instantiate the custom Manager in your models. See documentation for more examples.

Installation

Standard installation from pypi or local download.

$ pip install django-model-values
$ python setup.py install

Dependencies

  • Django 1.8+

  • Python 2.7, 3.3+

Tests

100% branch coverage.

$ py.test [--cov]

Changes

0.3

  • Lookup methods and operators

  • F expressions and aggregation methods

  • Database functions

  • Conditional expressions for updates and annotations

  • Bulk updates and change detection

0.2

  • Change detection

  • Groupby functionality

  • Named tuples

Project details


Download files

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

Source Distribution

django-model-values-0.3.tar.gz (18.3 kB view details)

Uploaded Source

File details

Details for the file django-model-values-0.3.tar.gz.

File metadata

File hashes

Hashes for django-model-values-0.3.tar.gz
Algorithm Hash digest
SHA256 8ca1375314f80f8effb72a8d9c91d3cba3df32ed5a7a54caf2262f567d7da616
MD5 5a40028a5a8e11f65d3fc37c3555fa1f
BLAKE2b-256 11f5566dbb1ba508b936d91b70aec77fb142e1ef6e81181808aa48956fd07fcd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page