only validate db_field if it's a string type

This commit is contained in:
Stefan Wojcik 2016-12-28 11:46:18 -05:00
parent e07cb82c15
commit 74b37d11cf

View File

@ -41,7 +41,7 @@ class BaseField(object):
"""
:param db_field: The database field to store this field in
(defaults to the name of the field)
:param name: Depreciated - use db_field
:param name: Deprecated - use db_field
:param required: If the field is required. Whether it has to have a
value or not. Defaults to False.
:param default: (optional) The default value for this field if no value
@ -82,7 +82,7 @@ class BaseField(object):
self._owner_document = None
# Validate the db_field
if self.db_field and (
if isinstance(self.db_field, six.string_types) and (
'.' in self.db_field or
'\0' in self.db_field or
self.db_field.startswith('$')