#20625: Custom Chainable QuerySets
-------------------------------------+-------------------------------------
     Reporter:  danols               |                    Owner:  loic84
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  QuerySet,            |      Needs documentation:  0
  models.Manager, chainable          |  Patch needs improvement:  0
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by loic84):

 * needs_better_patch:  1 => 0
 * needs_tests:  1 => 0
 * needs_docs:  1 => 0


Comment:

 PR https://github.com/django/django/pull/1328

 Docs probably need more love but that gives us something to work with.

 I had to change the implementation of `get_manager_class()` because it
 relied on `__dict__` which doesn't work with inheritance.

 I tried using `dir()` and the previous `callable()` test and while it
 worked for most purposes it also produced a few false positive; for
 example `base_manager_class` was picked up as a callable and made it into
 `new_methods`.

 In the end I use `inspect.getmembers()` with a `ismethod` predicate and
 the result has been very robust.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20625#comment:27>
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.ac3dd2600c7c14092de7b6800c3ebd2d%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to