Field with Validator always considered changed in migrations
|Reported by:||Daniel Hahler||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I am having the following model, and
schemamigration --auto considers it to be changed always.
This appears to get triggered through the RegexValidator (commenting it, does not cause the model to be considered different every time).
from django.core.validators import RegexValidator class Model(TimeStampedModel): foo_id = models.CharField( verbose_name='FOO ID', max_length=200, # allow for URL in form, cleaned in clean_foo_id validators = [RegexValidator(r'(?i)^(?:(?:https?://)?www.foo.com/title/)?(tt\d+)(?:/.*)?$')], help_text=_('…'), blank=True, null=True, unique=True)
This _might_ be related to #22255, but probably only because it's about the same field.. ;)