django error:IPAddressField has been removed except for support in historical migrations

created at 07-16-2021 views: 1

background

When using django to create a model, use model.IPAddressField to create a field. When making migrations, the error is as follows:

IPAddressField has been removed except for support in historical migrations.
        HINT: Use GenericIPAddressField instead.

According to the prompt message: Use GenericIPAddressField instead of IPAddressField.

reason

Before version 1.1 of django, IPAddressField can be used normally, and after version 1.1, only GenericIPAddressField can be used, because GenericIPAddressField supports ipv6, and IPAddressField only supports ipv4.

Please log in to leave a comment.