Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
5f3806b8
Kaydet (Commit)
5f3806b8
authored
Eyl 06, 2014
tarafından
Octowl
Kaydeden (comit)
Tim Graham
Eyl 08, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23307 -- Clarified the way max_num limits the output of formsets.
Thanks velle for the report.
üst
638d1393
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
formsets.txt
docs/topics/forms/formsets.txt
+13
-8
No files found.
docs/topics/forms/formsets.txt
Dosyayı görüntüle @
5f3806b8
...
...
@@ -91,8 +91,7 @@ Limiting the maximum number of forms
------------------------------------
The ``max_num`` parameter to :func:`~django.forms.formsets.formset_factory`
gives you the ability to limit the maximum number of empty forms the formset
will display::
gives you the ability to limit the number of forms the formset will display::
>>> from django.forms.formsets import formset_factory
>>> from myapp.forms import ArticleForm
...
...
@@ -103,16 +102,22 @@ will display::
<tr><th><label for="id_form-0-title">Title:</label></th><td><input type="text" name="form-0-title" id="id_form-0-title" /></td></tr>
<tr><th><label for="id_form-0-pub_date">Pub date:</label></th><td><input type="text" name="form-0-pub_date" id="id_form-0-pub_date" /></td></tr>
If the value of ``max_num`` is greater than the number of existing
objects, up to ``extra`` additional blank forms will be added to the formset,
so long as the total number of forms does not exceed ``max_num``.
If the value of ``max_num`` is greater than the number of existing items in the
initial data, up to ``extra`` additional blank forms will be added to the
formset, so long as the total number of forms does not exceed ``max_num``. For
example, if ``extra=2`` and ``max_num=2`` and the formset is initalized with
one ``initial`` item, a form for the initial item and one blank form will be
displayed.
If the number of items in the initial data exceeds ``max_num``, all initial
data forms will be displayed regardless of the value of ``max_num`` and no
extra forms will be displayed. For example, if ``extra=3`` and ``max_num=1``
and the formset is initialized with two initial items, two forms with the
initial data will be displayed.
A ``max_num`` value of ``None`` (the default) puts a high limit on the number
of forms displayed (1000). In practice this is equivalent to no limit.
If the number of forms in the initial data exceeds ``max_num``, all initial
data forms will be displayed regardless. (No extra forms will be displayed.)
By default, ``max_num`` only affects how many forms are displayed and does not
affect validation. If ``validate_max=True`` is passed to the
:func:`~django.forms.formsets.formset_factory`, then ``max_num`` will affect
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment