defrex/django-encrypted-fields

char field max length

Awmusic12635 opened this issue · 3 comments

Trying to make a migration and having an issue:

SystemCheckError: System check identified some issues:

ERRORS:
app.Server.password: (fields.E120) CharFields must define a 'max_length' attribute.

I saw there was a variable for "enforce_max_length", however that doesn't appear to get rid of the error. It still appears to complain if that is there. What is the proper way to handle this, enforce_max_length + max_length or just max_length?

Can you show me your field definition?

password=EncryptedCharField()

or

password=EncryptedCharField(enforce_max_length=60)

has this error.

if I do password=EncryptedCharField(enforce_max_length=60,max_length=60) it goes away, but I don't know if that hurts any of the way it operates.

Like a normal CharField, you need to specify max_length. enforce_max_length should be True or False, rather then a length value. It determines if a ValueError is raised when you try to save a longer value.