defrex / django-encrypted-fields

This is a collection of Django Model Field classes that are encrypted using Keyczar.
MIT License
193 stars 60 forks source link

char field max length #21

Closed Awmusic12635 closed 8 years ago

Awmusic12635 commented 8 years ago

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?

defrex commented 8 years ago

Can you show me your field definition?

Awmusic12635 commented 8 years ago

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.

defrex commented 8 years ago

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.