is migrated to:
{{{
my_field = CharField(
max_length=64,
validators=[RegexValidator(re.compile('pattern'))],
)
}}}
an uncaught `AttributeError: 'str' object has no attribute 'pattern'` will
be raised from here:
https://github.com/django/django/blob/59ab3fd0e9e606d7f0f7ca26609c06ee679ece97/django/db/migrations/utils.py#L18
,
caused by this comparison:
https://github.com/django/django/blob/59ab3fd0e9e606d7f0f7ca26609c06ee679ece97/django/db/migrations/autodetector.py#L1143
This is because comparing a `RegexObject` (the wrapper for a compiled
regex) to a string is not properly handled. This issue was introduced by
https://github.com/django/django/commit/91f701f4fc324cd2feb7dbf151338a358ca0ea18
--
Ticket URL: <https://code.djangoproject.com/ticket/33605>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Brian Helba
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33605#comment:1>
* needs_better_patch: 0 => 1
* type: Uncategorized => Bug
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted
Comment:
Thanks for the report.
[https://github.com/django/django/pull/15555 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/33605#comment:2>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33605#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"2d5215c675c2f128f7e9fc296cd5a0a5a527dff4" 2d5215c]:
{{{
#!CommitTicketReference repository=""
revision="2d5215c675c2f128f7e9fc296cd5a0a5a527dff4"
Fixed #33605 -- Fixed migration crash when altering RegexValidator to pre-
compiled regular expression.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33605#comment:4>