{"id":23568,"library":"django-cryptography-5","title":"django-cryptography","description":"django-cryptography provides encryption for Django model fields using AES. Current version 2.0.3, with a focus on simplicity and Django ORM integration. Release cadence is low; maintained by saaspegasus.","status":"active","version":"2.0.3","language":"python","source_language":"en","source_url":"https://github.com/saaspegasus/django-cryptography","tags":["django","encryption","fields","security"],"install":[{"cmd":"pip install django-cryptography","lang":"bash","label":"pip"}],"dependencies":[{"reason":"Cryptographic operations","package":"pycryptodome","optional":true}],"imports":[{"wrong":"from django_cryptography.fields import EncryptedCharField","symbol":"EncryptedCharField","correct":"from django_cryptography import EncryptedCharField"}],"quickstart":{"code":"import os\nimport django\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')\ndjango.setup()\n\nfrom django_cryptography.fields import EncryptedCharField\nfrom django.db import models\n\nclass MyModel(models.Model):\n    secret = EncryptedCharField(max_length=255)\n\n# Now you can create and save instances normally:\ninstance = MyModel.objects.create(secret='my secret')\nprint(instance.secret)  # Output: 'my secret'","lang":"python","description":"Define an encrypted char field in a Django model."},"warnings":[{"fix":"Do not use encrypted fields in `filter()`, `order_by()`, or indexing. Consider using a non-encrypted field or hashing for lookups.","message":"Encrypted fields are not sortable or filterable by their encrypted values. Querying by encrypted field will not work as expected.","severity":"gotcha","affected_versions":"all"},{"fix":"Back up existing data before changing SECRET_KEY. Implement manual re-encryption if key rotation is needed.","message":"If you change the `SECRET_KEY` in Django settings, all existing encrypted data will become undecryptable. There is no built-in key rotation.","severity":"gotcha","affected_versions":"all"},{"fix":"Update imports to `from django_cryptography.fields import ...`","message":"The package was previously named `django-cryptography` and later `django-encrypt`? Actually, the correct import path changed from `encrypt` to `django_cryptography`. Ensure you are not using the old import.","severity":"deprecated","affected_versions":"<2.0"}],"env_vars":null,"search_vec":"'2.0.3':17 'ae':14 'cadenc':28 'cryptographi':3,6 'current':15 'django':2,5,10,24,34 'django-cryptographi':1,4 'encrypt':8,35 'field':12,36 'focus':20 'integr':26 'low':30 'maintain':31 'model':11 'orm':25 'provid':7 'releas':27 'saaspegasus':33 'secur':37 'simplic':22 'use':13 'version':16","created_at":"2026-05-01T08:08:27.828771+00:00","updated_at":"2026-05-01T08:08:27.828771+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'EncryptedCharField' from 'django_cryptography' (/tmp/tmpieafa4h8/venv/lib/python3.12/site-packages/django_cryptography/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0.3","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/georgemarshall/django-cryptography","docs":"https://django-cryptography.readthedocs.io","changelog":null,"pypi":"https://pypi.org/project/django-cryptography-5/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security","database","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}