django-fernet-encrypted-fields
Symmetrically encrypted model fields for Django
What it is and what it does
django-fernet-encrypted-fields adds transparent encryption to Django model fields using Fernet symmetric encryption from the cryptography library. When you define an encrypted field, data is automatically encrypted before storage and decrypted on retrieval, with the encryption key managed via Django settings.
The package supports key rotation through SALT_KEY, which can be a list where the first key encrypts new data and all keys are tried for decryption. It also supports SECRET_KEY rotation via SECRET_KEY_FALLBACKS for Django >=4.1. The encrypted fields maintain the same APIs as their unencrypted Django counterparts.
Use it for:
- Encrypt personally identifiable information in a Django database without changing application code.
- Implement key rotation policies by maintaining a list of SALT_KEY values and re-saving records to migrate to new encryption keys.
- Store sensitive data encrypted at rest while maintaining Django ORM access.
- Migrate from an older django-encrypted-fields package to a maintained successor.
- Comply with data protection requirements by encrypting specific model fields without a separate encryption layer.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Django model fields that encrypt data at rest using Fernet symmetric encryption, storing encrypted values in the database while maintaining a standard Django field API.
Yes, with conditions. The package is actively maintained, has low install friction, and solves a real problem for encrypting sensitive Django model fields. However, verify the license status before use—the metadata shows no SPDX or raw license text. Requires Python >=3.10 and Django 4.2+, so confirm compatibility with your project's versions.
Install
django-fernet-encrypted-fields on PyPI
pip
pip install django-fernet-encrypted-fieldsuv
uv add django-fernet-encrypted-fieldspoetry
poetry add django-fernet-encrypted-fieldsInstalling django-fernet-encrypted-fields
Before you install
Low install friction with only two runtime dependencies (Django and cryptography). The package is actively maintained with a recent release and no known vulnerabilities.
License in practice
License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before use in commercial or proprietary projects.
Quickstart
pip install django-fernet-encrypted-fields
# In settings.py
SALT_KEY = '0123456789abcdefghijklmnopqrstuvwxyz'
# In models.py
from django.db import models
class MyModel(models.Model):
text_field = EncryptedTextField()
Requires Python >=3.10 and Django 4.2 or later.
Verify before relying
- Which specific encrypted field types are available and their exact APIs.
- Whether key rotation via SALT_KEY list works with all supported Django versions.
- Performance impact of encryption/decryption on query performance and bulk operations.
- How SECRET_KEY_FALLBACKS interacts with the SALT_KEY rotation mechanism.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — Django, cryptography |
| Maintenance | actively maintained — 122 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 359,135/month — #7,253 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_fernet_encrypted_fields-0.4.0-py3-none-any.whl
Tags
More Cryptography packages
Certifi provides Mozilla's curated collection…
copyleft · top 100 on PyPI
cryptographycryptography provides cryptographic recipes and…
permissive · top 100 on PyPI
rsaPure-Python RSA encryption, decryption,…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
PyNaClPyNaCl provides Python bindings to libsodium…
permissive · top 1,000 on PyPI
django-fernet-fields-v2Provides Fernet symmetric encryption for Django…
permissive · top 5,000 on PyPI
fernetA pure Python implementation of the Fernet…
permissive · top 15,000 on PyPI
djfernetProvides Fernet symmetric encryption for Django…
permissive · top 15,000 on PyPI
django-encrypted-model-fieldsWraps Django model fields with transparent…
permissive · top 15,000 on PyPI
django-cryptography-django5Encrypts and decrypts data in Django models…
permissive · top 15,000 on PyPI
django-cryptography-5Provides encrypted model fields and…
permissive · top 15,000 on PyPI
django-cryptographyWraps Python's cryptography library to add…
permissive · top 15,000 on PyPI
kasa-cryptProvides fast encryption and decryption…
permissive · top 15,000 on PyPI
cryptoProvides command-line tools to encrypt and…
permissive · top 5,000 on PyPI