﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33605	Use of RegexValidator can cause migration generation to raise AttributeError	Brian Helba	Brian Helba	"If a model:
{{{
my_field = CharField(
    max_length=64,
    validators=[RegexValidator('pattern')],
)
}}}

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"	Bug	closed	Migrations	4.0	Normal	fixed			Ready for checkin	1	0	0	0	0	0
