Changes between Initial Version and Version 2 of Ticket #29739


Ignore:
Timestamp:
Sep 6, 2018, 4:22:37 AM (6 years ago)
Author:
Mark Gensler
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29739 – Description

    initial v2  
    1818This is because `BaseFormSet.total_form_count()` blindly uses self.extra and does not take into account the additional data in `self.initial_extra`.
    1919
    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.
     20In 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.
    2121
    2222Possible solutions are the number of extra forms equals `self.extra + len(self.initial_extra)` or `max(self.extra, len(self.initial_extra))`.
Back to Top