#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:  Accepted  |     Has_patch:  1     
        Needs_docs:  0         |   Needs_tests:  0     
Needs_better_patch:  0         |  
-------------------------------+--------------------------------------------
Comment (by kmtracey):

 The note above is not the whole story...the 'caching' of the queryset by
 `get_queryset()` in !BaseModelFormSet was never used in old (pre-[7270])
 code by !BaseInlineFormSet because first it wasn't there until [8805] and
 second !BaseInlineFormSet has always over-ridden `get_queryset()` so the
 superclass method was never called for a !BaseInlineFormset anyway.  So I
 think the change in [7270] was a general cleanup to not not provide a
 parameter to the superclass init that wasn't doing anything -- since the
 subclass had its own `get_queryset()`.

 The problem here was introduced in [8805], when the need for caching the
 queryset was introduced by the addition of the _construct_form method that
 contains a loop for initial_form_count that contains within it
 `self.get_queryset()[i]`.  That's what's causing the limit/offset queries.
 At the same time !BaseModelFormSet's `get_queryset()` was modified to
 cache the queryset in `_queryset`, but this isn't used by a
 !BaseInlineFormSet because it has its own `get_queryset()` method.

 It doesn't look to me like there is any good reason for !BaseInlnieFormSet
 to have it's own `get_queryset()` instead of just computing it during
 init, passing it in as a parameter to the superclass init, and then
 letting the superclass `get_querset()` do its thing.  Besides the
 `_queryset` caching, !BaseInlineFormSet's method is also missing the bit
 about limiting the query to `max_num`.  So even though only `max_num`
 inlines are displayed in the admin, the actual database query is not
 limited.

 So I'm even more inclined to check in a slight variant on the
 inline_queryset.diff patch (I still don't see why queryset should be
 exposed as a param to !BaseInlineFormSet) barring feedback to the
 contrary.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9076#comment:20>
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 django-updates@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to