#9076: Inline forms can result in a "Please correct the errors below." message
with no errors listed.
---------------------------------+------------------------------------------
Reporter: coady | Owner: nobody
Status: reopened | Milestone:
Component: Forms | Version: 1.0
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------+------------------------------------------
Comment (by kmtracey):
I'm inclined to check inline_queryset.diff (or a slight variant) in but
I'd like some feedback from Joseph and/or Brian first, because the patch
undoes part of [7270]. That is, older code used to do what the patch
does, but it was changed at one point not to, so I'd like to understand
why before just restoring the old behavior.
Prior to [7270], (Base)!InlineFormSet `__init__` called its
`get_queryset()` method and passed the result in as the qs arg for the
superclass init. [7270] removed the call to `get_queryset()` and also
removed the parameter from the superclass init. [7270] also did a lot of
other stuff so it's not clear the motivation for this specific part of the
change.
An (undesirable) effect is that the queryset caching built in to the
superclass' `get_queryset()` is no longer used. As a result an individual
database query is made for each inline element in the set (first limit 1,
then offset 1 limit 1, then offset 2 limit 1, etc). Not only does this
add a lot of extra queries but apparently #9006 also means sometimes that
sequence of queries doesn't actually return all the items, but rather some
duplicates, which causes the invisible error.
So, going back to the old way seems like a good idea but I thought I'd
check first if anyone could remember why the code that used to do things
this way was changed? I'd prefer to not re-introduce a previously fixed
bug but rather come up with a solution that fixes both problems...if I
knew what the first problem was.
Also, as it is the patch exposes queryset as an arg to !BaseInlineFormSet.
That doesn't seem necessary to fix the bug and wasn't in the old code so I
don't see why it should be done?
--
Ticket URL: <http://code.djangoproject.com/ticket/9076#comment:18>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---