mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Refs #27118 -- Reallowed using pk in QuerySet.get/update_or_create().
This commit is contained in:
parent
040bd7c938
commit
1db1f74617
2 changed files with 14 additions and 1 deletions
|
@ -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'." % (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue