Recursion error when deleting model object through admin
|Reported by:||m3wolf||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
When I try to delete a specific object using the admin interface I get an error:
RuntimeError at /admin/gtd/node/1470/delete/ maximum recursion depth exceeded while calling a Python object
It appears to be trying to convert something to unicode but I don't know what. From the Django error message I can see that the object appears as <Node: [<span style="color: rgba(230, 138, 0, 1.0)"><strong>DFRD</strong></span>] Test todo item>, which doesn't seem to have any weird characters in it. The title is what I expect to be return from __str__(self) as described below.
If I delete a different object (which has similar HTML markup in it) from the same model it works with no errors. The model in question defines __str__(self) which returns the value from a models.TextField() attribute wrapped in some HTML (<span style="..."></span>) which is passed through mark_safe() before being returned. The model is decorated with @python_2_unicode_compatible. Following the python3 migration guide, I added from __future__ import unicode_literals at the top of my models.py and removed __unicode__(self) but no difference.
The stacktrace doesn't seem to go through my code anywhere.
I git-pulled the latest changes to stable/1.5.x from github and reinstalled Django after removed the previous installation from dist-packages but the problem persists.
I have not tried deleting this object pythonically; I figured I'd keep that object for now in case anyone needs me to reproduce the problem.
Change History (11)
comment:1 Changed 4 years ago by akaariai
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:6 Changed 4 years ago by aaugustin
- Component changed from Uncategorized to Python 2
- Has patch set
- Needs tests set
- Severity changed from Normal to Release blocker
comment:7 Changed 4 years ago by Aymeric Augustin <aymeric.augustin@…>
- Resolution set to fixed
- Status changed from new to closed