Below I call the same methods in author
and w5
model objects. But one of them raises an error:
>>> author = models.Author('ali')
>>> author.article_set.count()
---------------------------------------------
ValueError: invalid literal for int() with base 10: 'ali'
>>> w5 = models.Author(name='w5')
>>> w5.article_set.count()
0
Actually, before these lines I had previously a wrong Author
class definition. I obtained the ValueError
from author object first with that former definition of Author
. Then I changed Author
class and reloaded the modules.
After reloading the models with the reloadmodels.py written by Chad Braun-Duin, newly instantiated objects like w5
work properly. But reinstantiated objects like author
raise errors.
Is this contradictory behavior due to django's query caching logic or reloadmodels.py? Have any idea?
Thanks...