﻿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
22255	RegexValidator needs support for flags passed to `re.compile` (migrations do not allow for compiled patterns)	Daniel Hahler	Dejan Noveski	"When using a RegexValidator with a compiled pattern, `makemigration` fails:

{{{
ValueError: Cannot serialize: <_sre.SRE_Pattern object at 0x24e8ac0>
}}}

A sample model:
{{{
from django.core.validators import RegexValidator
pattern = re.compile(r'foo', re.IGNORECASE)
validator = RegexValidator(pattern)

class Model(models.Model):
    foo = models.CharField(
        validators = [validator],
        ...
    )
}}}

This is somehow expected, and when passing in the pattern uncompiled it works.
But this won't allow to use re.IGNORE_CASE or other flags for `re.compile` anymore.

RegexValidator should support a new argument `flags`, which would then be used for non-compiled patterns (passed on to `re.compile`).
(https://github.com/django/django/blob/master/django/core/validators.py#L25)

Let me know, if I could provide a pull request / patch for this (as far as I can see) trivial change.

(It seems like with the new migrations, supporting a pre-compiled pattern is not really relevant anymore (but could be kept still))

(I found this related commit: https://github.com/django/django/commit/e565e1332ddfbb44fe7e6139375e3c243af7398d)"	Cleanup/optimization	closed	Core (Other)	dev	Normal	fixed		Dejan Noveski	Ready for checkin	1	0	0	0	1	0
