Code

#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.

Attachments (0)

Change History (1)

comment:1 Changed 14 months 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.

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.