[FIX] fields: set attributes before accessing them

If renamed attributes are used, a warning is emit with `repr` of the
culprit field, which need attributes to be set.

Fixes #14036
This commit is contained in:
Christophe Simonis
2016-11-17 13:40:24 +01:00
parent 48d5420d7f
commit bcddba4e4b
+2 -2
View File
@@ -456,14 +456,14 @@ class Field(object):
if not attrs.get('readonly'):
attrs['inverse'] = self._inverse_sparse
self.set_all_attrs(attrs)
# check for renamed attributes (conversion errors)
for key1, key2 in RENAMED_ATTRS:
if key1 in attrs:
_logger.warning("Field %s: parameter %r is no longer supported; use %r instead.",
self, key1, key2)
self.set_all_attrs(attrs)
# prefetch only stored, column, non-manual and non-deprecated fields
if not (self.store and self.column_type) or self.manual or self.deprecated:
self.prefetch = False