Skip to main content

ModelDict is a very efficient way to store things like settings in your database. The entire model is transformed into a dictionary (lazily) as well as stored in your cache. It’s invalidated only when it needs to be (both in process and based on CACHE_BACKEND).

Quick example usage. More docs to come (maybe?):

class Setting(models.Model):
    key = models.CharField(max_length=32)
    value = models.CharField(max_length=200)
settings = ModelDict(Setting, key='key', value='value', instances=False)

# access missing value
settings['foo']
>>> KeyError

# set the value
settings['foo'] = 'hello'

# fetch the current value using either method
Setting.objects.get(key='foo').value
>>> 'hello'

settings['foo']
>>> 'hello'

Release files for django-modeldict-rc 1.3.1

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-modeldict-rc 1.3.1
File Size Uploaded
django-modeldict-rc-1.3.1.tar.gz 9.7 kB Details

Release files / django-modeldict-rc-1.3.1.tar.gz

Download URL django-modeldict-rc-1.3.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
db25de80a1f1f91df6609924cb782c3a78d5482c77ffe49f66486a4b43dc3ff5
BLAKE2b-256 checksum
How to use checksums
af68a10d79f38ee1aabbbb92b6f7c30e7fc8eb1badde2444c8a8d163c2a96581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.3.1 This release

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