summaryrefslogtreecommitdiff
path: root/docs/ref/contrib/admin
diff options
context:
space:
mode:
authorAnders Steinlein <anders@e5r.no>2014-03-05 21:19:40 +0100
committerTim Graham <timograham@gmail.com>2014-05-15 07:25:35 -0400
commit4ef10f245ada0c7d5ae8dc31eebffa63790d40fb (patch)
treedffd7ca06862fa20b5fa0b4528ac8beeecaee9fa /docs/ref/contrib/admin
parent860d31ac7a3bdd4b27db8b34b110b3d801ddaf8a (diff)
Fixed #17642 -- Added min_num support to modelformsets, inlines, and the admin.
Thanks Stephen Burrows for work on the patch as well. Forwardport of 2914f66983a92fcae55673c517dd8d01e8c238c4 from stable/1.7.x
Diffstat (limited to 'docs/ref/contrib/admin')
-rw-r--r--docs/ref/contrib/admin/index.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 1a02d3fc3b..876bf290c3 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -1966,6 +1966,16 @@ The ``InlineModelAdmin`` class adds:
:meth:`InlineModelAdmin.get_max_num` also allows you to customize the
maximum number of extra forms.
+.. attribute:: InlineModelAdmin.min_num
+
+ .. versionadded:: 1.7
+
+ This controls the minimum number of forms to show in the inline.
+ See :func:`~django.forms.models.modelformset_factory` for more information.
+
+ :meth:`InlineModelAdmin.get_min_num` also allows you to customize the
+ minimum number of displayed forms.
+
.. attribute:: InlineModelAdmin.raw_id_fields
By default, Django's admin uses a select-box interface (<select>) for
@@ -2042,6 +2052,16 @@ The ``InlineModelAdmin`` class adds:
return max_num - 5
return max_num
+.. method:: InlineModelAdmin.get_min_num(request, obj=None, **kwargs)
+
+ .. versionadded:: 1.7
+
+ Returns the minimum number of inline forms to use. By default,
+ returns the :attr:`InlineModelAdmin.min_num` attribute.
+
+ Override this method to programmatically determine the minimum number of
+ inline forms. For example, this may be based on the model instance
+ (passed as the keyword argument ``obj``).
Working with a model with two or more foreign keys to the same parent model
---------------------------------------------------------------------------