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 CommaSeparatedIntegerFieldas 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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With