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

Built distribution (wheel)

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

Total release size: 122.1 kB

Release files / django_eav2-2.0.1.tar.gz

Download URL django_eav2-2.0.1.tar.gz
Size 52.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a7e6172b15be19856fa5055366d751de88dd7fb540ee2ce68b8f2e68a703bfa3
BLAKE2b-256 checksum
How to use checksums
a8ddcba6e3b6d7913315efd7a37b4341759de925a6c1e7a01cd7c507a52788c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

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

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

Security for django-eav2 2.0.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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