django-fields icon indicating copy to clipboard operation
django-fields copied to clipboard

Wrong max_length value when using south

Open DXist opened this issue 13 years ago • 5 comments

I'm not sure why max_length is calculated this way: kwargs['max_length'] = max_length * 2 + len(self.prefix)

When I use south I get field length max_length * 2 + len(self.prefix) in my migration file and (max_length * 2 + len(self.prefix))*2 + len(self.prefix) in database.

In my opinion max_length shouldn't be changed if it is in kwargs and another key value like 'unencrypted_max_length' should be used:


        max_length = kwargs.pop('unencrypted_max_length', 40)
        ...
        kwargs['max_length'] = kwargs.get('max_length', max_length * 2 + len(self.prefix))

DXist avatar Sep 16 '11 09:09 DXist