I was building integer array field for color.
I tried to use CommaSeparatedIntegerField but it was depreated
CommaSeparatedIntegerField has been deprecated.
Support for it (except in historical migrations) will be removed in Django 2.0.
HINT: Use CharField(validators=[validate_comma_separated_integer_list]) instead
So I used set the color field as CharField
instead of CommaSeparatedIntegerField
as recommended
from django.core.validators import validate_comma_separated_integer_list
class Cloth(models.Model):
color = models.CharField(validators=validate_comma_separated_integer_list)
But I'm getting this error when I makemigrations
TypeError: 'RegexValidator' object is not iterable
Why am I getting this error? I followed the exact guideline :(
first of all CharField
requires a max_length
field and validators
need to be in a list
[]
so,
class Cloth(models.Model):
color = models.CharField(validators=[validate_comma_separated_integer_list],max_length=100)