Changes between Initial Version and Version 2 of Ticket #29739
- Timestamp:
- Sep 6, 2018, 4:22:37 AM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29739 – Description
initial v2 18 18 This is because `BaseFormSet.total_form_count()` blindly uses self.extra and does not take into account the additional data in `self.initial_extra`. 19 19 20 In order to work around this users would check `len(initial)` before constructing the class and modify the `extra` kwarg to be `max(len(initial), some_default_value)`. This causes issues when writing abstract code which constructs the class separately from initialising it, or reuses the same class with differing initial data. In these cases the length of the initial data may not be known at the time of class construction.20 In order to work around this users would check `len(initial)` before constructing the class and modify the `extra` kwarg to be large enough. This causes issues when writing abstract code which constructs the class separately from initialising it, or reuses the same class with differing initial data. In these cases the length of the initial data may not be known at the time of class construction. 21 21 22 22 Possible solutions are the number of extra forms equals `self.extra + len(self.initial_extra)` or `max(self.extra, len(self.initial_extra))`.