Open Chetchaiyan opened 1 year ago
Hi @Chetchaiyan Could you please provide more information about your case? A minimal test case would be perfect. I just tried the next and don't see any problems:
from fireo import db
from fireo.fields import TextField
from fireo.models import Model
class A(Model):
a = TextField()
def test_extra_fields():
a = A()
a.a = 'a'
a._a = '_a'
a.save()
assert db.conn.document(a.key).get().to_dict() == {'a': 'a'}
Sorry, I can't come up with minimal case. I will do my best. However, in the mean time, Please consider the following error as a clue.
def __setattr__(self, key, value):
"""Keep track which filed values are changed"""
if key in self._meta.field_list:
> self._field_changed.add(key)
E AttributeError: 'NoneType' object has no attribute 'add'
../../anaconda3/envs/py11/lib/python3.11/site-packages/fireo/models/model.py:535: AttributeError
I suppose, you override __init__
but forgot to call super().__init__(**kwargs)
inside it. So, please, try to add it to the beginning of your method.
Dear All, I found the error during migrate to v2.0.0 so at the moment I stuck with v1.7.0
The error appear in case of I mix up models with instance variable eg.
when save() _a has been evaluated as field variable.