Ticket #13023: 13023_inlines_patch.diff
File 13023_inlines_patch.diff, 1.8 KB (added by , 15 years ago) |
---|
-
AUTHORS
507 507 Cheng Zhang 508 508 Glenn Maynard <glenn@zewt.org> 509 509 bthomas 510 Gabriel Hurley <gabriel@strikeawe.com> 510 511 511 512 A big THANK YOU goes to: 512 513 -
django/forms/models.py
687 687 return super(BaseInlineFormSet, self).initial_form_count() 688 688 689 689 def total_form_count(self): 690 # To avoid breaking default behavior of max_num = 0, we can set 691 # max_num to the queryset length and trigger the limiting effect 692 # that prevents the creation of new inlines. 693 if self.max_num == 0 and self.extra == 0: 694 self.max_num = len(self.get_queryset()) 690 695 if self.save_as_new: 691 696 return super(BaseInlineFormSet, self).initial_form_count() 692 697 return super(BaseInlineFormSet, self).total_form_count() -
docs/ref/contrib/admin/index.txt
1048 1048 1049 1049 .. versionadded:: 1.2 1050 1050 1051 Extra forms for inlines will be hidden and replaced with a link to dynamically 1052 add any number of new inlines for users with Javascript enabled. 1051 A link to dynamically add any number of new inlines will be added to the last 1052 inline form of the formset for users with Javascript enabled. To prevent the 1053 dynamic creation of new inlines (and remove that link), specify a value of 0 1054 for both ``extra`` and ``max_num`` (0 is the default for ``max_num``). 1053 1055 1054 1056 ``max_num`` 1055 1057 ~~~~~~~~~~~