[FIX] models: simplify conditions that seem to lead to missing fields

This commit is contained in:
Raphael Collet 2014-11-13 10:06:30 +01:00
parent fc2975a9af
commit 552dab0dc8
1 changed files with 2 additions and 3 deletions

View File

@ -516,7 +516,7 @@ class BaseModel(object):
"""
def add(name, field):
""" add `field` with the given `name` if it does not exist yet """
if name not in cls._columns and name not in cls._fields:
if name not in cls._fields:
cls._add_field(name, field)
# cyclic import
@ -811,8 +811,7 @@ class BaseModel(object):
cls._fields = {}
above = cls.__bases__[0]
for attr, field in getmembers(above, Field.__instancecheck__):
if not field.inherited:
cls._add_field(attr, field.new())
cls._add_field(attr, field.new())
# introduce magic fields
cls._add_magic_fields()