Fixed #19733 - deprecated ModelForms without 'fields' or 'exclude', and added '__all__' shortcut
This also updates all dependent functionality, including modelform_factory and modelformset_factory, and the generic views `ModelFormMixin`, `CreateView` and `UpdateView` which gain a new `fields` attribute.
This commit is contained in:
@@ -60,9 +60,11 @@ class TestModel(models.Model):
|
||||
class TestModelForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = TestModel
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
TestModelFormSet = forms.models.modelformset_factory(TestModel, form=TestModelForm, extra=2)
|
||||
TestModelFormSet = forms.models.modelformset_factory(TestModel, form=TestModelForm, extra=2,
|
||||
fields='__all__')
|
||||
|
||||
|
||||
class TestWizard(WizardView):
|
||||
|
||||
@@ -15,6 +15,7 @@ from django.utils._os import upath
|
||||
class UserForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = User
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
UserFormSet = forms.models.modelformset_factory(User, form=UserForm, extra=2)
|
||||
|
||||
Reference in New Issue
Block a user