﻿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
17603	Forms have list-mutability issues with field validator lists	brett@…	nobody	"
{{{
from django.forms import Form
from django.forms.fields import IntegerField
from django.core.validators import MinValueValidator

class SampleForm(Form):
    some_field = IntegerField()

    def __init__(self, *args, **kwargs):
        super(SampleForm, self).__init__(*args, **kwargs)
        self.fields['some_field'].validators.append(MinValueValidator(1))

first_form = SampleForm()
print len(first_form.fields['some_field'].validators)
# Prints 1

second_form = SampleForm()
print len(second_form.fields['some_field'].validators)
# Prints 2
}}}

I believe this has to do with the fact that the __deepcopy__ method on Field , which does a shallow copy of everything except for 'widget'. I could see two potential solutions here:
 * Do a deepcopy on everything (potentially risky)
 * Do a deepcopy on validators and any other fields which could potentially be a list.

While searching, I found ticket #4167, which was similar to this, but pertained more to the Field class itself having mutability issues rather than the Form initialization code."	Bug	closed	Forms	1.3	Normal	duplicate			Unreviewed	0	0	0	0	0	0
