Opened 4 years ago

Closed 4 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


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)

Change History (1)

comment:1 Changed 4 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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: Test object>])

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

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