--
Ticket URL: <https://code.djangoproject.com/ticket/23824>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* needs_better_patch: => 0
* owner: nobody => olasitarska
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/23824#comment:1>
* status: assigned => new
* owner: olasitarska =>
Comment:
Together with Baptiste and Loic I managed to reproduce that, but we've
decided that this is an expected behaviour. It only happens when you
actually declare a field in a model form:
{{{
#!python
from django import forms
from .models import SampleModel
class BaseForm(forms.ModelForm):
number = forms.CharField()
class Meta:
model = SampleModel
class SubclassForm(BaseForm):
class Meta(BaseForm.Meta):
exclude = ['number',]
}}}
Then you can see a number field in the form, but it doesn't get saved.
Should I document it somewhere?
--
Ticket URL: <https://code.djangoproject.com/ticket/23824#comment:2>
Comment (by dbrgn):
This would be the test to reproduce the issue:
{{{
#!diff
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -473,6 +473,7 @@ class ModelFormBaseTest(TestCase):
def test_subclassmeta_form(self):
class SomeCategoryForm(forms.ModelForm):
checkbox = forms.BooleanField()
+ othertext = forms.CharField()
class Meta:
model = Category
@@ -483,7 +484,7 @@ class ModelFormBaseTest(TestCase):
list.
"""
class Meta(SomeCategoryForm.Meta):
- exclude = ['url']
+ exclude = ['url', 'othertext']
self.assertHTMLEqual(
str(SubclassMeta()),
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23824#comment:3>
Comment (by timgraham):
I think the documentation was added in #8620, but perhaps it needs further
clarification?
--
Ticket URL: <https://code.djangoproject.com/ticket/23824#comment:4>
* status: new => closed
* resolution: => duplicate
Comment:
Closing as duplicate unless reporter can provide additional information as
to why the current documentation is insufficient (I'd guess he probably
didn't see it).
--
Ticket URL: <https://code.djangoproject.com/ticket/23824#comment:5>