2👍
✅
You need to put exception handling in:
try:
dancer = signedup.objects.get(pk=pk)
except signedup.DoesNotExist:
# handle error
My answer will fix the exceptions your getting, but it looks like you’ve got some other issues with your code:
- Why would your
team_signup
andsignedup
share a primary key? - Why do you try to delete both types of things at once?
You probably should be passing a single primary key (for the object being deleted) and the type of the object so you know what to delete from where.
Source:stackexchange.com