Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8577 closed (fixed)

Admin raises UnboundLocalError

Reported by: evenrik Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py", line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py", line 175, in root
    return self.app_index(request, url)

  File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py", line 392, in app_index
    app_dict = {

UnboundLocalError: local variable 'model_dict' referenced before assignment

Code added in [8474] for #1390 produced this error. The untested patch should fix this.

Attachments (1)

patch.diff (1.6 KB) - added by evenrik 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by evenrik

Attachment: patch.diff added

comment:1 Changed 8 years ago by evenrik

Summary: Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py", line 86, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py", line 175, in root return self.app_index(request, url) File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py", line 392, in app_index app_dict = { Admin raises UnboundLocalErrorAdmin raises UnboundLocalError

comment:2 Changed 8 years ago by evenrik

The patch also fixes

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py", line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py", line 175, in root
    return self.app_index(request, url)

  File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py", line 401, in app_index
    app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name']))

KeyError: 'models'

comment:3 Changed 8 years ago by Malcolm Tredinnick

milestone: 1.0

What are the steps I need to take to repeat this traceback?

comment:4 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [8607]) Fixed #8577 -- Fixed a couple of indentation errors when viewing the app-index
page in admin. Patch by evenrik.

comment:5 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

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