Opened 8 years ago

Closed 8 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:


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 8 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by leotr

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedDesign decision needed

Changed 8 years ago by leotr

Attachment: db-api.diff added

comment:2 Changed 8 years ago by leotr

Owner: changed from nobody to leotr
Status: newassigned
Triage Stage: Design decision neededAccepted

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

comment:3 Changed 8 years ago by leotr

Triage Stage: AcceptedReady for checkin

comment:4 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: assignedclosed

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

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