Tweak admin 'Action' to avoid Cannot call delete() after .distinct()

21 views
Skip to first unread message

Mike Dewhirst

unread,
Mar 20, 2022, 5:58:17 PM3/20/22
to Django users
I am using tweaked querysets to populate the Admin and fully understand
why this error occurs.

I am using Actions to perform bulk operations on selected records so I
do need the Action selector widget.

How can I remove the 'Delete selected...' option?

Thanks

Mike


TypeError at /admin/chemical/chemical/

Cannot call delete() after .distinct().

Request Method: POST
Request URL: http://localhost:8088/admin/chemical/chemical/
Django Version: 3.2.12
Exception Type: TypeError
Exception Value:

Cannot call delete() after .distinct().

Exception Location:
D:\Users\mike\envs\xxai\lib\site-packages\django\db\models\query.py,
line 728, in delete
Python Executable: D:\Users\mike\envs\xxai\Scripts\python.exe
Python Version: 3.8.3
Python Path:

['/var/www/aicis',
'D:\\Users\\mike\\envs\\xxai\\aicis',
'C:\\Python38\\python38.zip',
'C:\\Python38\\DLLs',
'C:\\Python38\\lib',
'C:\\Python38',
'D:\\Users\\mike\\envs\\xxai',
'D:\\Users\\mike\\envs\\xxai\\lib\\site-packages']

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages