Skip to content

Commit 43fcce4

Browse files
committed
Tweaked the exception message for Django's DoesNotExist messages to make it easier to figure out the situation.
- Legacy-Id: 6316
1 parent b335ef3 commit 43fcce4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

django/db/models/query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ def get(self, *args, **kwargs):
343343
if num == 1:
344344
return clone._result_cache[0]
345345
if not num:
346-
raise self.model.DoesNotExist("%s matching query does not exist."
347-
% self.model._meta.object_name)
346+
raise self.model.DoesNotExist("%s matching query does not exist. Lookup parameters were %s"
347+
% (self.model._meta.object_name, kwargs))
348348
raise self.model.MultipleObjectsReturned("get() returned more than one %s -- it returned %s! Lookup parameters were %s"
349349
% (self.model._meta.object_name, num, kwargs))
350350

0 commit comments

Comments
 (0)