Refs #27118 -- Reallowed using pk in QuerySet.get/update_or_create().

This commit is contained in:
François Freitag 2016-10-03 19:57:05 -07:00 committed by Tim Graham
parent 040bd7c938
commit 1db1f74617
2 changed files with 14 additions and 1 deletions

View file

@ -532,7 +532,8 @@ class QuerySet(object):
try:
self.model._meta.get_field(param)
except exceptions.FieldDoesNotExist:
invalid_params.append(param)
if param != 'pk': # It's okay to use a model's pk property.
invalid_params.append(param)
if invalid_params:
raise exceptions.FieldError(
"Invalid field name(s) for model %s: '%s'." % (