# "MaximumRecursion" error while deleting the object.

**URL:** <https://forum.djangoproject.com/t/maximumrecursion-error-while-deleting-the-object/31114>\
**Category:** Mystery Errors\
**Created:** [May 13, 2024, 9:34am UTC](https://forum.djangoproject.com/t/maximumrecursion-error-while-deleting-the-object/31114 "2024-05-13T09:34:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshalkumar-ishi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harshalkumar-ishi/32/14653_2.png) [@harshalkumar-ishi](https://forum.djangoproject.com/u/harshalkumar-ishi)\
**Post date:** [May 13, 2024, 9:34am UTC](https://forum.djangoproject.com/t/maximumrecursion-error-while-deleting-the-object/31114/1 "2024-05-13T09:34:19Z")

</div>

So the issue is for deleting the object.  
Whenever i was trying to delete an object it was taking some time and showing the error which is **“maximum recursion depth exceeded while calling a Python object”** This error is comming before rendering the delete\_confirmation page.  
I had checked that it is raising an exception at

`/usr/local/lib/python3.11/site-packages/django/db/models/base.py` , line 594, in **eq**

 ![Screenshot 2024-05-13 150301](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/0/c/0ca1a64fec4cec8b7029e8949f9395c58eb4ece4.jpeg)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 13, 2024, 12:20pm UTC](https://forum.djangoproject.com/t/maximumrecursion-error-while-deleting-the-object/31114/2 "2024-05-13T12:20:48Z")

</div>

It would help if you posted the model(s) involved here, along with your model admin class.

---

<div class="post-metadata">

**Author:** ![charettes](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/charettes/32/27_2.png) [@charettes](https://forum.djangoproject.com/u/charettes)\
**Post date:** [May 14, 2024, 1:40am UTC](https://forum.djangoproject.com/t/maximumrecursion-error-while-deleting-the-object/31114/3 "2024-05-14T01:40:11Z")

</div>

As @KenWhitesell pointed out full model definitions will be necessary to properly diagnose your issue.

I highly suspect you are accessing attributes in one of your model’s ` __init__ ` [as described here](https://code.djangoproject.com/ticket/31435#comment:4) and [is documented against doing](https://docs.djangoproject.com/en/5.0/ref/models/instances/#django.db.models.Model).

> Additionally, referring to model fields within ` __init__ ` may potentially result in infinite recursion errors in some circumstances.

---

<div class="post-metadata">

**Author:** ![harshalkumar-ishi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harshalkumar-ishi/32/14653_2.png) [@harshalkumar-ishi](https://forum.djangoproject.com/u/harshalkumar-ishi)\
**Post date:** [May 14, 2024, 7:33am UTC](https://forum.djangoproject.com/t/maximumrecursion-error-while-deleting-the-object/31114/4 "2024-05-14T07:33:24Z")

</div>

I could not directly give you the models and model admin classes, because of the security reasons.

I can tell that i haven’t overridden any delete method in model admin.

What i wanted to do is that there is a logic which is used to render the delete confirmation page so i want to overpass that method and show the pop-up message which should used to confirm the delete.

---

<div class="post-metadata">

**Author:** ![harshalkumar-ishi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harshalkumar-ishi/32/14653_2.png) [@harshalkumar-ishi](https://forum.djangoproject.com/u/harshalkumar-ishi)\
**Post date:** [May 14, 2024, 7:35am UTC](https://forum.djangoproject.com/t/maximumrecursion-error-while-deleting-the-object/31114/5 "2024-05-14T07:35:58Z")

</div>

I haven’t done this.

---

<div class="post-metadata">

**Author:** ![harshalkumar-ishi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harshalkumar-ishi/32/14653_2.png) [@harshalkumar-ishi](https://forum.djangoproject.com/u/harshalkumar-ishi)\
**Post date:** [May 14, 2024, 11:35am UTC](https://forum.djangoproject.com/t/maximumrecursion-error-while-deleting-the-object/31114/7 "2024-05-14T11:35:56Z")

</div>

For more information i have the screenshot

 ![maximum_recursion_error_depth_exceed_while_calling_python_object](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/d/6/d6049a2be2ecd84dda812413c9da69e1395c405a.jpeg)
