Skip to main content

Build Status codecov Python Version Django Version Jazzband

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. Administrators can add and change attributes at runtime, in the Django admin or in code, without a migration.

It is a fork of django-eav, which was itself derived from eav-django.

Read the documentation at https://django-eav2.readthedocs.io.

Install

pip install django-eav2

Add eav to INSTALLED_APPS, then run python manage.py migrate:

INSTALLED_APPS = [
    # ...
    "eav",
]

The package's tables use BigAutoField primary keys. To use UUIDs, set EAV2_PRIMARY_KEY_FIELD = "django.db.models.UUIDField" before the first migrate. See the configuration docs.

Quick start

Register a model, create an attribute, then store and query values:

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")

Is EAV right for you?

EAV trades query speed and simplicity for flexibility. It suits open-ended, sparse, or user-defined properties, and is a poor fit for stable, known columns or performance-critical reporting. The concepts page explains the model, when to use it, when to avoid it, and the alternatives.

Contributing

See CONTRIBUTING.md. The project is part of Jazzband, which has a code of conduct.

Metadata

Release files for django-eav2 2.0.0

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-eav2 2.0.0
File Size Uploaded Provenance
django_eav2-2.0.0.tar.gz 52.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-eav2 2.0.0
File Interpreter ABI Platform
django_eav2-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 121.8 kB

Release files / django_eav2-2.0.0.tar.gz

Download URL django_eav2-2.0.0.tar.gz
Size 52.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3d06bfd87ec347af52e7633eea8c4f287e9839fddca77aca06406ee9315f3083
BLAKE2b-256 checksum
How to use checksums
721cf7b88a4b387dff370c262cab2816f2e6776edc5d3a386036b68101885a09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Release files / django_eav2-2.0.0-py3-none-any.whl

Download URL django_eav2-2.0.0-py3-none-any.whl
Size 69.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f2d99a848f2d4abe22254831de62d9ce85bb42a71ff0ddae084b051dc83f96d
BLAKE2b-256 checksum
How to use checksums
b36dd48795ad928503105f2d716c4738b03e8e896271841ee1b1837ce78b263b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Security for django-eav2 2.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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