Opened 17 years ago

Closed 17 years ago

#6875 closed (wontfix)

Allow for easier QuerySet customization.

Reported by: floguy Owned by: floguy
Component: Uncategorized Version: queryset-refactor
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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?

Attachments (1)

custom_queryset_setting.diff (2.8 KB ) - added by floguy 17 years ago.

Download all attachments as: .zip

Change History (6)

by floguy, 17 years ago

comment:1 by floguy, 17 years ago

Needs tests: set

By the way, I'm completely at a loss for how to test this, as settings don't seem to be able to be reconfigured on-the-fly.

comment:2 by David Cramer, 17 years ago

from django.conf import settings
settings.HI = 1

comment:3 by floguy, 17 years ago

dcramer: I'm not sure exactly what that was supposed to mean. An accidental submit?

comment:4 by David Cramer, 17 years ago

Sorry, should have been on two lines, but you can import the settings in such a manner to reconfigure most settings "on the fly" as you put it.

comment:5 by Jacob, 17 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top