On Tuesday, September 5, 2017 at 3:38:17 PM UTC+4, Michal Petrucha wrote:
On Tue, Sep 05, 2017 at 03:47:37AM -0700, Roman Akopov wrote:
So the deal is that each model's _meta caches a bunch of structures
storing the list of fields, reverse relations, and so on, the first
time you access any of them. If you add a new field (or a new reverse
relation) after those caches have already been filled, the new field
or relation won't be reflected in them, leading to errors just like
yours.
There's an internal undocumented API that takes care of this,
Model._meta._expire_cache(), which will clear all those caches. It
should do the trick for you, but as always with private APIs, be aware
that it might break or change in the future.
Cheers,
Michal
Michael,
Thanks for great hint!
Unfortulately, it did not help. I have added "model._meta._expire_cache()" call almost everywhere, before generating dynamic model, after, between steps, it did not help a bit, error is exactly the same.
Also, I have additionally tested my application against django 1.10 and django 1.9 and got exactly the same result.
Roman
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e60febee-ab7e-4bbe-a637-6a4302f835bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment