#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:  1
  models.Manager, chainable          |  Patch needs improvement:  1
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  1                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 Yes, I like the smart defaults idea more than opt-in.

 The only ugly case in the as_manager() approach seems to be that if you
 want manager-only methods you will need to create a Manager class, and
 then use MyQuerySet.as_manager(base_cls=MyManager) (or alternatively
 subclass MyQuerySet.manager_cls()). This isn't as-pretty-as-possible. But,
 in general having methods on the qs even if they only make sense as
 manager methods isn't too bad. Django has multiple examples of this,
 qs.create() doesn't actually make sense, but the create on qs doesn't hurt
 anybody either.

 I am sure that if one defines the same method on both the qs and the
 manager in complex enough ways you can break super(). This seems to be a
 case of "don't do that".

 I think it is now the time to complete the patch.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20625#comment:22>
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.98f43c92fdefd6858a85368eec14a4fe%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to