[Answer]-What column type does django use for models.IPAddressField() in Sqlite3

1👍

Something like this should get the correct answer:

from django.db import connection

for field in Model._meta._fields():
    print field, field.db_type(connection)

which on sqlite3 should give you something like this for an IPAddressField:

<django.db.models.fields.IPAddressField object at 0x101520410> char(15)

or if you’re using multiple databases:

from django.db import connections

connection = connections['your_db_alias']

for field in Model._meta._fields():
    print field, field.db_type(connection)

0👍

I think it’s just an varchar(15). The definition of IPAddressField() doesn’t change much of the normal Field behavior.

👤sa3m

Leave a comment