Allow for easier QuerySet customization.
|Reported by:||floguy||Owned by:||floguy|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
The impetus for this patch is that it will be difficult for the built-in QuerySet implementation to satisfy everyone's needs (as evidenced by some vehement disagreements about aggregate functionality on django-dev).
Currently the only way to really deal with this is to fork Django and keep a local copy up to date.
This patch allows for the specification of a default QuerySet class (which can be located anywhere on the PythonPath) which will be used in all query operations. To add group_by functionality, for example, one could subclass django.db.models.query.BaseQuerySet and add a group_by function. Then, specify DEFAULT_QUERYSET_CLASS to be the path to your custom subclass. Now group_by would be available in all filters, managers, etc. without ever having forked Django.
In fact, there could now be a whole host of externally-hosted QuerySet subclasses, and therefore new ideas could be more easily experimented with.
Thoughts? Ideas? Should I bring this up on django-dev?
Change History (6)
Changed 8 years ago by floguy
comment:1 Changed 8 years ago by floguy
- Needs documentation unset
- Needs tests set
- Patch needs improvement unset