#36251: BaseInlineFormSet modifies Meta.fields of passed form class if
Meta.fields
is type list
--------------------------------+--------------------------------------
Reporter: ifeomi | Owner: (none)
Type: Bug | Status: new
Component: Forms | Version: 5.2
Severity: Normal | Resolution:
Keywords: inline formset | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by Sarah Boyce):
* stage: Accepted => Unreviewed
Comment:
Thank you for the report!
Replicated
{{{#!diff
--- a/tests/model_formsets/tests.py
+++ b/tests/model_formsets/tests.py
@@ -1685,9 +1685,10 @@ class ModelFormsetTest(TestCase):
class Meta:
model = Book
- fields = ("title",)
+ fields = ["title"]
BookFormSet = inlineformset_factory(Author, Book, form=BookForm)
+ self.assertEqual(BookForm.Meta.fields, ["title"])
data = {
"book_set-TOTAL_FORMS": "3",
"book_set-INITIAL_FORMS": "0",
@@ -1698,6 +1699,7 @@ class ModelFormsetTest(TestCase):
}
author = Author.objects.create(name="test")
formset = BookFormSet(data, instance=author)
+ self.assertEqual(BookForm.Meta.fields, ["title"])
self.assertEqual(
formset.errors,
[{}, {"__all__": ["Please correct the duplicate values
below."]}, {}],
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36251#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701958b294ef0-59d7bfaa-f193-4837-8e65-1e748a00a24d-000000%40eu-central-1.amazonses.com.