skillfed

django-encrypted-model-fields

A set of fields that wrap standard Django fields with encryption provided by the python cryptography library.

django-encrypted-model-fields v0.6.5 523.8K downloads/30d#6,192 on PyPI
Permissive license MIT Abandoned released

What it is and what it does

django-encrypted-model-fields provides Django ORM field types that automatically encrypt and decrypt data using cryptography. When you define a model field as an encrypted variant, data is encrypted before storage in the database and decrypted transparently when accessed in Python. The encryption key is read from Django settings (FIELD_ENCRYPTION_KEY) rather than from a file on disk, making it compatible with 12-factor app design and platforms like Heroku where environment variables are the standard way to manage secrets.

The package depends only on cryptography and Django, giving it low install friction. However, it has been abandoned for over four years with no active maintenance, meaning it may not work with the latest Django or Python releases, and any security issues discovered would not be patched.

Use it for:

  • Store sensitive user data in Django models with automatic encryption at the database layer.
  • Meet compliance requirements that mandate encryption of personally identifiable information in databases.
  • Deploy Django applications to Heroku or similar platforms where encryption keys come from environment variables.
  • Protect against database breaches by ensuring encrypted fields remain unreadable if the database is compromised.
  • Migrate from older encryption approaches to a Python 3-compatible solution without rewriting field definitions.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Wraps Django model fields with transparent encryption using the cryptography library, storing encrypted data in the database while allowing normal field access in Python code.

No. While the package has no known vulnerabilities, it is abandoned with no maintenance for over four years. The risk of incompatibility with future Django or Python versions, combined with the certainty that security issues will not be patched, makes it unsuitable for new projects. Consider actively maintained alternatives or implement field-level encryption directly using cryptography.

Install

django-encrypted-model-fields on PyPI

pip

pip install django-encrypted-model-fields

uv

uv add django-encrypted-model-fields

poetry

poetry add django-encrypted-model-fields

Installing django-encrypted-model-fields

Before you install

Low install friction with only two runtime dependencies (cryptography and Django). However, the package is abandoned—last release was 1632 days ago with no recent maintenance activity. Use only if you can accept the risk of unpatched issues and incompatibility with future Django or Python versions.

License in practice

MIT license is permissive and imposes no restrictions on use, modification, or distribution in commercial or private projects.

Quickstart

pip install django-encrypted-model-fields

# In settings.py:
INSTALLED_APPS = [..., 'django-encrypted-model-fields']
FIELD_ENCRYPTION_KEY = os.environ.get('FIELD_ENCRYPTION_KEY')

# In models.py:
from django-encrypted-model-fields.fields import EncryptedCharField
class MyModel(models.Model):
    secret = EncryptedCharField(max_length=100)

Requires FIELD_ENCRYPTION_KEY to be set in Django settings; generate one with the manage.py generate_encryption_key command or manually via base64.urlsafe_b64encode(os.urandom(32)).

Verify before relying

  • Compatibility with Django versions released after 4.0 (last tested version in classifiers).
  • Whether the package works reliably with current cryptography library versions.
  • Whether filtering and sorting limitations on encrypted fields are acceptable for your use case.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6,<4.0)
Install friction low — pure-Python wheel
Runtime dependencies 2 — cryptography, Django
Maintenance abandoned — 1,632 days since the last release
First released
Downloads 523,837/month — #6,192 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_encrypted_model_fields-0.6.5-py3-none-any.whl

Keywords: encryption, django, fields

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 2.2Framework :: Django :: 3.0Framework :: Django :: 3.1Framework :: Django :: 3.2Framework :: Django :: 4.0Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: SecurityTopic :: System :: Systems Administration :: Authentication/Directory

Tags

django encrypted fieldsencrypt django model datatransparent field encryptiondjango cryptography integrationencrypted database fieldsdjango data encryption at restsecure django model fields
django-ormfield-encryptionabandoned

More WWW/HTTP packages