Opened 3 years ago

Closed 3 years ago

#32505 closed New feature (wontfix)

Allow queryset.extra() to specify OR operation

Reported by: James Lin Owned by: nobody
Component: Database layer (models, ORM) Version: 2.2
Severity: Normal Keywords: extra, or
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by James Lin)

Currently in django Query class, it is using AND as default operation

def add_extra(self, select, select_params, where, params, tables, order_by):
    ...
    if where or params:
        self.where.add(ExtraWhere(where, params), AND)
    ...

We should be able to pass op argument so I can use OR operation

Change History (2)

comment:1 by James Lin, 3 years ago

Description: modified (diff)

comment:2 by Tim Graham, 3 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: wontfix
Status: newclosed

The documentation for QuerySet.extra() says:

This is an old API that we aim to deprecate at some point in the future. Use it only if you cannot express your query using other queryset methods. If you do need to use it, please file a ticket using the QuerySet.extra keyword with your use case (please check the list of existing tickets first) so that we can enhance the QuerySet API to allow removing extra(). We are no longer improving or fixing bugs for this method.

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