django-encrypted-model-fields
A set of fields that wrap standard Django fields with encryption provided by the python cryptography library.
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-fieldsuv
uv add django-encrypted-model-fieldspoetry
poetry add django-encrypted-model-fieldsInstalling 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
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
django-cryptographyWraps Python's cryptography library to add…
permissive · top 15,000 on PyPI
django-cryptography-5Provides encrypted model fields and…
permissive · top 15,000 on PyPI
django-cryptography-django5Encrypts and decrypts data in Django models…
permissive · top 15,000 on PyPI
django-fernet-encrypted-fieldsProvides Django model fields that encrypt data…
unclear · top 15,000 on PyPI
django-fernet-fields-v2Provides Fernet symmetric encryption for Django…
permissive · top 5,000 on PyPI
dynamodb-encryption-sdkEncrypts and decrypts DynamoDB items…
permissive · top 15,000 on PyPI
djfernetProvides Fernet symmetric encryption for Django…
permissive · top 15,000 on PyPI
tensealTenSEAL performs homomorphic encryption…
permissive · top 15,000 on PyPI
sqlcipher3sqlcipher3 is a Python DB-API 2.0 interface to…
permissive · top 15,000 on PyPI
daveyImplements the Discord Audio & Video End-to-End…
permissive · top 5,000 on PyPI