An implementation of model-attribute-value for Django, without using generic relations.
Install using pip (soon - use GitHub for now):
pip install django-mav
Alternatively, you can install download or clone this repo and call pip install -e ..
Add to INSTALLED_APPS in your settings.py:
In your models, decorate models that need to store model-attribute-values with @mav.
from django.db import models from mav.decorators import mav @mav class Foo(models.Model): name = models.CharField(max_length=100) # The @mav decorator will generate a FooAttr class in mav.attrs: class FooAttr(AbstractModelAttribute): # Inherited from AbstractModelAttribute attribute = models.ForeignKey(Attribute) value = models.TextField(...) # Generated object = models.ForeignKey(Foo, related_name='attrs')
Contributions and pull requests for other Django and Python versions are welcome.
If you have found a bug or if you have a request for additional functionality, please use the issue tracker on GitHub.
You can use this under the MIT License. See LICENSE file for details.