mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #16138 -- Made FormMixin get_initial return a copy of the 'initial' class variable. Thanks hanson2010, wilfred@potatolondon.com and agriffis for their work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17765 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -5,11 +5,20 @@ from django.core.urlresolvers import reverse
|
||||
from django import forms
|
||||
from django.test import TestCase
|
||||
from django.utils.unittest import expectedFailure
|
||||
from django.views.generic.edit import FormMixin
|
||||
|
||||
from . import views
|
||||
from .models import Artist, Author
|
||||
|
||||
|
||||
class FormMixinTests(TestCase):
|
||||
def test_initial_data(self):
|
||||
""" Test instance independence of initial data dict (see #16138) """
|
||||
initial_1 = FormMixin().get_initial()
|
||||
initial_1['foo'] = 'bar'
|
||||
initial_2 = FormMixin().get_initial()
|
||||
self.assertNotEqual(initial_1, initial_2)
|
||||
|
||||
class ModelFormMixinTests(TestCase):
|
||||
def test_get_form(self):
|
||||
form_class = views.AuthorGetQuerySetFormView().get_form_class()
|
||||
|
||||
Reference in New Issue
Block a user