django-cryptography
django-cryptography copied to clipboard
FieldError: Unsupported lookup 'exact' for EncryptedCharField
Hi all,
I have to first say thanks to everyone who contributed and gave this wonderful app for us mere mortal to use and help ease the process of encrypting data at the database level.
Anyway today I just started a new project using: python 3.10 django 4.0.6 django-cryptography 1.1
usually I can wrap my field with encrypt using
class Detail(models.Model):
nric= encrypt(
models.CharField(
_("NRIC"),
max_length=12,
validators=[
RegexValidator(
regex="^[0-9]{12}$",
message=_("NRIC must be numbers only")
),
MinLengthValidator(
limit_value=12,
message=_("NRIC must be 12 digit only")
),
MaxLengthValidator(
limit_value=12,
message=_("NRIC must be 12 digit only")
)
]
)
)
however when i am trying to query using the following statement
def query_detail(nric : str):
detail : Detail | None = Detail.objects.filter(nric = nric ).first()
the following error was raise
FieldError(
django.core.exceptions.FieldError: Unsupported lookup 'exact' for EncryptedCharField or join on the field not permitted, perhaps you meant exact or iexact?
any help on how to debug this issue would be great. However, i dont mind changing library if I have too
BTW: Django admin works just fine
Thanks Ash