Code

Opened 6 years ago

Closed 6 years ago

#7260 closed (fixed)

fixed db-api documentation on queryset.get() method

Reported by: leotr Owned by: leotr
Component: Documentation Version: master
Severity: Keywords: db-api
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

According to documentation:

get() raises AssertionError if more than one object was found

According to the Queryset.get():

        if num == 1:
            return clone._result_cache[0]
        if not num:
            raise self.model.DoesNotExist("%s matching query does not exist."
                    % self.model._meta.object_name)
        raise self.model.MultipleObjectsReturned("get() returned more than one %s -- it returned %s! Lookup parameters were %s"

Seems like documentation is wrong.

Attachments (1)

db-api.diff (718 bytes) - added by leotr 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 6 years ago by leotr

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

Changed 6 years ago by leotr

comment:2 Changed 6 years ago by leotr

  • Owner changed from nobody to leotr
  • Status changed from new to assigned
  • Triage Stage changed from Design decision needed to Accepted

Actually it's a bug, so i think that it should be checked in without decision of core team

comment:3 Changed 6 years ago by leotr

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [7559]) Fixed #7260 -- Corrected the description of the exception returned by get() when multiple objects match the search criteria. Thanks, leotr.

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.