Skip to main content

image image image image image build image CodeQL image ty

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

Typical model usage is verbose, inefficient, and incorrect.

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

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

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

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)
books["rating"]

Column-oriented syntax is common in panel data layers, and the greater expressiveness cascades. QuerySets also support aggregation and conditionals.

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

books.aggregate(models.Avg("rating"))["rating__avg"]
books["rating"].mean()

Managers provide a variety of efficient primary key based utilities. To enable, instantiate the Manager in your models. As with any custom Manager, it doesn't have to be named objects, but it is designed to be a 100% compatible replacement.

from model_values import Manager


class Book(models.Model):
    ...
    objects = Manager()

F expressions are also enhanced, and can be used directly without model changes.

from model_values import F

.filter(rating__gt=0, last_modified__range=(start, end))
.filter(F.rating > 0, F.last_modified.range(start, end))

Installation

pip install django-model-values

Tests

100% branch coverage.

pytest [--cov]

Metadata

Release files for django-model-values 1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-model-values 1.8
File Size Uploaded
django_model_values-1.8.tar.gz 14.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-model-values 1.8
File Interpreter ABI Platform
django_model_values-1.8-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / django_model_values-1.8.tar.gz

Download URL django_model_values-1.8.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ff019e52021fe0ada220833e616b972ab59dde11aa580a20f737e7bfe061c0d2
BLAKE2b-256 checksum
How to use checksums
ac2c125196790bb83d462f47cd03695b2735b2c539d9606105a09ab7c2345d23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.

Transparency log

Release files / django_model_values-1.8-py3-none-any.whl

Download URL django_model_values-1.8-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0113175aefb2c3c8f9ad261c0bba11382bf561a1751db28675ff2a511d599fd7
BLAKE2b-256 checksum
How to use checksums
07f0a2729454d40cb122b4dd67ef371fa2bccc6bc34e1c6a520bb539c1e6532e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.8 This release

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

0.6

2 release files

0.5.1

2 release files

0.5

2 release files

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page