Skip to content

`manage createsuperuser` error

Sorry if this is a false positive. I'm not sure if the issue is real or from my project:

  • Django: 3.2

On python manage.py createsuperuser command I got the Nonetype has no attribute _meta at this line: https://gitlab.com/guywillett/django-searchable-encrypted-fields/-/blob/master/encrypted_fields/fields.py#L364

I think this is because the createsuperuser command invokes the clean here, passing model_instance=None: https://github.com/django/django/blob/6e742dabc95b00ba896434293556adeb4dbaee8a/django/contrib/auth/management/commands/createsuperuser.py#L187

I have modify the line to:

return self.model._meta.get_field(self.encrypted_field_name).clean(
            value, model_instance
        )

And it works.

Do you believe this issue is real and this is a good solution?

Thank you very much.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information