Code

Opened 6 years ago

Closed 6 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: UI/UX:

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 6 years ago.

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by floguy

comment:1 Changed 6 years ago by floguy

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset

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 Changed 6 years ago by dcramer

from django.conf import settings
settings.HI = 1

comment:3 Changed 6 years ago by floguy

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

comment:4 Changed 6 years ago by dcramer

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 Changed 6 years ago by jacob

  • Resolution set to wontfix
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.