I want to add an ip list (ex. ['192.168.0.1','...',]) into Django Model TextField. I don't know the serializer and validator well, so I keep getting the error 'not a valid string'. How can I change it?
1 Answer
you are most probably trying to save list in text field, which will not be possible, you can use array fields
https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#arrayfield
class ChessBoard(models.Model):
board = ArrayField(
ArrayField(
models.CharField(max_length=10, blank=True),
size=8,
),
size=8,
)
not a valid string, please show your code that yielded this error to help in understanding