Opened 8 years ago

Closed 8 years ago

#27634 closed Cleanup/optimization (invalid)

Refactor Query.clone _setup_query logic

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords:
Cc: me@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently Query.clone() does:

if hasattr(obj, '_setup_query'):
            obj._setup_query()

Afaict there's only one subclass of Query that has a _setup_query method: UpdateQuery. The other users were DateQuerySet and DateTimeQuerySet which got removed in #23867 by Anssi. The call can be pushed down into UpdateQuery which already overrides clone().

Change History (1)

comment:1 by Adam Johnson, 8 years ago

Resolution: invalid
Status: assignedclosed

Actually this can't be removed as it's needed when instantiating the Query after it was created with clone(klass=UpdateQuery). This might go away if we get to actually call Query.__init__ to create clones with different classes, after #27624.

Note: See TracTickets for help on using tickets.
Back to Top