django-polymorphic icon indicating copy to clipboard operation
django-polymorphic copied to clipboard

refresh_from_db RecursionError

Open devxplorer opened this issue 7 years ago • 8 comments

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.

devxplorer avatar Dec 11 '17 10:12 devxplorer

Thanks for giving such nice example! This is something that clearly needs to be fixed.

vdboor avatar Jan 22 '18 09:01 vdboor

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 avatar Mar 13 '18 14:03 AndySun25

@AndySun25 Thank you for your comment, I'll try your solution when I have the opportunity

devxplorer avatar Mar 15 '18 11:03 devxplorer

Is there any update on this issue?

Vader19695 avatar May 23 '21 02:05 Vader19695

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

nanorepublica avatar May 23 '22 07:05 nanorepublica

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.

GuerrettaG avatar Jun 14 '23 09:06 GuerrettaG