Taking the O out of ORM.
Project description
About django-model-values
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-model-values-0.3.tar.gz
.
File metadata
- Download URL: django-model-values-0.3.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca1375314f80f8effb72a8d9c91d3cba3df32ed5a7a54caf2262f567d7da616 |
|
MD5 | 5a40028a5a8e11f65d3fc37c3555fa1f |
|
BLAKE2b-256 | 11f5566dbb1ba508b936d91b70aec77fb142e1ef6e81181808aa48956fd07fcd |