check for dynamic document, exclude id pk and _cls
This commit is contained in:
@@ -63,12 +63,13 @@ class BaseDocument(object):
|
|||||||
|
|
||||||
# Check if there are undefined fields supplied, if so raise an
|
# Check if there are undefined fields supplied, if so raise an
|
||||||
# Exception.
|
# Exception.
|
||||||
for var in values.keys():
|
if not self._dynamic:
|
||||||
if var not in self._fields.keys():
|
for var in values.keys():
|
||||||
msg = (
|
if var not in self._fields.keys() + ['id', 'pk', '_cls']:
|
||||||
"The field '{}' does not exist on the document '{}'"
|
msg = (
|
||||||
).format(var, self._class_name)
|
"The field '{}' does not exist on the document '{}'"
|
||||||
raise FieldDoesNotExist(msg)
|
).format(var, self._class_name)
|
||||||
|
raise FieldDoesNotExist(msg)
|
||||||
|
|
||||||
if self.STRICT and not self._dynamic:
|
if self.STRICT and not self._dynamic:
|
||||||
self._data = StrictDict.create(allowed_keys=self._fields_ordered)()
|
self._data = StrictDict.create(allowed_keys=self._fields_ordered)()
|
||||||
|
Reference in New Issue
Block a user