Opened 13 years ago

Closed 13 years ago

#17773 closed Uncategorized (worksforme)

Django does not catch ProtectedError when DEBUG=True

Reported by: anonymous Owned by: nobody
Component: Uncategorized Version: 1.4-beta-1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django does not catch ProtectedError when DEBUG=True

It return:
A server error occurred. Please contact the administrator.

class A(models.Model):
   ...

class B(models.Model):
    link = models.ForeignKey(A, on_delete=models.PROTECT)


a = A.objects.get(pk=1)
B.objects.create(link=a)
a.delete()

Change History (1)

comment:1 by Claude Paroz, 13 years ago

Resolution: worksforme
Status: newclosed

Just tested with current code, and I cannot reproduce your bug. I got a proper exception page:

ProtectedError at /

("Cannot delete some instances of model 'Sample' because they are referenced through a protected foreign key:
 'Test.link'", [<Test: Test object>])
...

You should try to debug your project to see why it is failing for you (django/core/handlers/base.py, around the handle_uncaught_exception method).

Note: See TracTickets for help on using tickets.
Back to Top