django-modeldict

Stores a model as a dictionary

Showing:

Popularity

Downloads/wk

0

GitHub Stars

131

Maintenance

Last Commit

6yrs ago

Contributors

6

Package

Dependencies

0

License

UNKNOWN

Categories

Readme


NOTICE: Deprecated

This project is deprecated and no longer actively maintained by Disqus <https://disqus.com/>. However there is a fork being maintained by YPlan at github.com/YPlan/django-modeldict <https://github.com/YPlan/django-modeldict> and a similar project by Disqus at github.com/disqus/durabledict <https://github.com/disqus/durabledict/>_.


django-modeldict

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'

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100