Opened 2 years ago

Closed 2 years ago

#19961 closed Bug (invalid)

Examples of "Complex lookups with Q objects" using objects.get

Reported by: ec.dani@… Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I see that "Complex lookups with Q objects" from
https://docs.djangoproject.com/en/1.4/topics/db/queries/
is using objects.get as example to retrieve multiple objects, but this raise a MultipleObjectsReturned exception.

Change History (1)

comment:1 Changed 2 years ago by charettes

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed
  • Version changed from 1.4 to master

As stated in the Complex lookups with Q objects:

Each lookup function that takes keyword-arguments (e.g. filter(), exclude(), get()) can also be passed one or more Q objects as positional (not-named) arguments.

The examples only use get but I can't find that retrieve multiple objects reference, you can use complex lookups to retrieve a single object.

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