#19881: Document that get_next/previous_by_FOO uses default manager
--------------------------------------+------------------------------------
     Reporter:  jtiai                 |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Documentation         |                  Version:  1.4
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by carljm):

 * needs_better_patch:   => 0
 * component:  Database layer (models, ORM) => Documentation
 * needs_tests:   => 0
 * needs_docs:   => 0
 * type:  Uncategorized => Cleanup/optimization
 * stage:  Unreviewed => Accepted


Comment:

 Model instances don't have a memory of how they were queried for, and the
 only way to "fix" this would be to add such a memory. I think the
 downsides of adding that additional state to model instances far outweighs
 the benefit of fixing this behavior; it would require much stronger
 coupling between both managers and the querysets they return, and
 querysets and the instances they query for. `get_next` and `get_previous`
 operate with respect to the entire set of model instances of that type,
 not some arbitrarily narrowed set. If you need them to operate with
 respect to a narrowed set, you can pass additional filter arguments to
 them.

 It would be worth documenting this more clearly, however; accepting and
 changing the component to documentation.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19881#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to