Opened 10 years ago

Last modified 22 months ago

#24267 assigned Cleanup/optimization

Simplify Query.build_filter()

Reported by: Anssi Kääriäinen Owned by: Simon Charette
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no
Pull Requests:16817, 4036 unmerged

Description

Now that the old way of building lookups isn't supported any more, we could restructure build_filter(). Steps included:

  • Remove related field's get_lookup_constraint(), instead write proper lookups for relational fields, too.
  • Do not use lookup_name in build_filter(), instead use Lookup flags where needed.
  • Ultimate goal could be usage of resolve_ref() in build_filter() instead of direct use of setup_joins(). In this case build_filter() would be simplified a lot. It is uncertain if this goal is achievable.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (4)

comment:1 by Tim Graham, 10 years ago

Has patch: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

PR (currently has a test failure)

comment:2 by Tim Graham <timograham@…>, 10 years ago

In b68212f:

Refs #24267 -- Implemented lookups for related fields

Previously related fields didn't implement get_lookup, instead
related fields were treated specially. This commit removed some of
the special handling. In particular, related fields return Lookup
instances now, too.

Other notable changes in this commit is removal of support for
annotations in names_to_path().

comment:3 by Tim Graham, 10 years ago

Has patch: unset
Patch needs improvement: unset

comment:4 by Simon Charette, 22 months ago

Owner: changed from nobody to Simon Charette
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top