django-polymorphic
django-polymorphic copied to clipboard
refresh_from_db RecursionError
We have a case where we need to track the status change on the model. This is done by assigning an current status attribute in the init method.
In tests in many places we use the refresh_from_db method, together all these things give an error with recursion.
To illustrate the error, a simple project was created: https://github.com/devxplorer/onchange
I'm not sure if this can be considered a bug, but I have not come up with the problem yet.
Thanks for giving such nice example! This is something that clearly needs to be fixed.
We had a similar issue to this a while back, using https://django-model-utils.readthedocs.io/en/latest/utilities.html#field-tracker ultimately ended up fixing the issue for us.
Perhaps it could be of use.
@AndySun25 Thank you for your comment, I'll try your solution when I have the opportunity
Is there any update on this issue?
I am starting to hit this issue (using the model utils FieldTracker) when upgrading to the following versions:
- Django 3.2
- Django-polymorphic 3.1.0
- Django model utils 4.2.0
Definitely happy to help find a fix
Hi, just wanted to say that we were facing the same issue, but I couldn't reproduce locally until I set settings.DISABLE_SERVER_SIDE_SETTINGS=True for our postgres DB. With settings.DISABLE_SERVER_SIDE_SETTINGS=False I wasn't getting the error.