#17270: methods of the manager on subqueries QuerySet objects
-------------------------------------+-------------------------------------
Reporter: Wojciech Banaś | Owner: fizista@…
<fizista@…> | Status: new
Type: New feature | Version:
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Design
Severity: Normal | decision needed
Keywords: queryset manager | Needs documentation: 1
Extends | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by Wojciech Banaś <fizista@…>):
* easy: 0 => 1
Comment:
Indeed, the dynamic class caused a lot of problems. I've enclosed a
different solution based on various other solutions. It is downward
compatible. This gives two possible ways of implementation.
- inside model class
{{{
objects_second = PersonManagerSecond(ManagerQuerySet, ['get_fun_people',
'get_not_fun_people'])
}}}
or inside manager class
{{{
class PersonManager(models.Manager):
def __init__(self):
super(PersonManager, self).__init__()
self.implement_queryset_cls(ManagerQuerySet)
self.implement_queryset_methods('get_fun_people',
'get_not_fun_people')
}}}
For more details refer to attachment: manager_queryset.diff
This implementation passed all django tests.
--
Ticket URL: <https://code.djangoproject.com/ticket/17270#comment:7>
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 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.