summaryrefslogtreecommitdiff
path: root/django/db/models/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/base.py')
-rw-r--r--django/db/models/base.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 27c9ff6461..55b1691166 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -442,7 +442,11 @@ class Model(metaclass=ModelBase):
if val is _DEFERRED:
continue
_setattr(self, field.attname, val)
- kwargs.pop(field.name, None)
+ if kwargs.pop(field.name, NOT_PROVIDED) is not NOT_PROVIDED:
+ raise TypeError(
+ f"{cls.__qualname__}() got both positional and "
+ f"keyword arguments for field '{field.name}'."
+ )
# Now we're left with the unprocessed fields that *must* come from
# keywords, or default.