Django EAV 2#
Django EAV 2 stores extra, typed attributes for your Django models without changing their tables. Define an attribute once, then read, write, and filter it on any registered model as if it were a field.
import eav
from django.db import models
from eav.models import Attribute
class Supplier(models.Model):
name = models.CharField(max_length=100)
eav.register(Supplier)
Attribute.objects.create(name="City", datatype=Attribute.TYPE_TEXT)
supplier = Supplier.objects.create(name="Acme", eav__city="London")
supplier.eav.city # "London"
Supplier.objects.filter(eav__city="London")
The attributes live in their own tables, so an administrator can add or change them at runtime, in the Django admin or in code, without a migration.
New to the library? Start with Getting started. To decide whether the entity-attribute-value pattern fits your problem, read Concepts.
Guide
Reference