diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-03-27 23:03:56 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-03-27 23:03:56 +0000 |
| commit | aba95dcc0b5370ffac3d3b701c3ca7782ee999c1 (patch) | |
| tree | b1bd806435d62fd4db98518e08dab0e6ce733c54 /django/forms/models.py | |
| parent | 9df8d9c2946bf74288d410e2dc8917493b079b11 (diff) | |
Fixed #13023 - Removed ambiguity with regard to the max_num option of formsets and as a result of admin inlines. Thanks to Gabriel Hurley for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12872 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/models.py')
| -rw-r--r-- | django/forms/models.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index 869138c922..608b87bd33 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -448,10 +448,10 @@ class BaseModelFormSet(BaseFormSet): if not qs.ordered: qs = qs.order_by(self.model._meta.pk.name) - if self.max_num > 0: - self._queryset = qs[:self.max_num] - else: - self._queryset = qs + # Removed queryset limiting here. As per discussion re: #13023 + # on django-dev, max_num should not prevent existing + # related objects/inlines from being displayed. + self._queryset = qs return self._queryset def save_new(self, form, commit=True): @@ -649,7 +649,7 @@ class BaseModelFormSet(BaseFormSet): def modelformset_factory(model, form=ModelForm, formfield_callback=lambda f: f.formfield(), formset=BaseModelFormSet, extra=1, can_delete=False, can_order=False, - max_num=0, fields=None, exclude=None): + max_num=None, fields=None, exclude=None): """ Returns a FormSet class for the given Django model class. """ @@ -799,7 +799,7 @@ def _get_foreign_key(parent_model, model, fk_name=None, can_fail=False): def inlineformset_factory(parent_model, model, form=ModelForm, formset=BaseInlineFormSet, fk_name=None, fields=None, exclude=None, - extra=3, can_order=False, can_delete=True, max_num=0, + extra=3, can_order=False, can_delete=True, max_num=None, formfield_callback=lambda f: f.formfield()): """ Returns an ``InlineFormSet`` for the given kwargs. |
