#913 closed defect (fixed)
[patch] incorrect `list_filter` field error message a bit stranger than necessary
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
See backtrace and model file. It breaks when I try to see a list of restaurants.
Attachments (4)
Change History (10)
by , 19 years ago
Attachment: | AttributeError at _admin_lunchbox_restaurants_.htm added |
---|
by , 19 years ago
Attachment: | lunchbox.py added |
---|
comment:1 by , 19 years ago
comment:2 by , 19 years ago
(My last comment was made before lunchbox.py
was posted, and refers only to the attached HTML file.)
comment:3 by , 19 years ago
Traceback (innermost last) * /home/elazutkin/djsrc/django/core/handlers/base.py in get_response 66. # Apply view middleware 67. for middleware_method in self._view_middleware: 68. response = middleware_method(request, callback, param_dict) 69. if response: 70. return response 71. 72. try: 73. response = callback(request, **param_dict) ... 74. except Exception, e: 75. # If the view raised an exception, run it through exception 76. # middleware, and if the exception middleware returns a 77. # response, use that. Otherwise, reraise the exception. 78. for middleware_method in self._exception_middleware: 79. response = middleware_method(request, e) ▶ Local vars Variable Value DEBUG True INTERNAL_IPS () ROOT_URLCONF 'home.urls' callback <function _checklogin at 0x4087ad4c> db <module 'django.core.db' from '/home/elazutkin/djsrc/django/core/db/__init__.pyc'> e <exceptions.AttributeError instance at 0x408b66ec> exceptions <module 'django.core.exceptions' from '/home/elazutkin/djsrc/django/core/exceptions.pyc'> mail_admins <function mail_admins at 0x4076da74> middleware_method <bound method CommonMiddleware.process_request of <django.middleware.common.CommonMiddleware instance at 0x4056c28c>> param_dict {'module_name': 'restaurants', 'app_label': 'lunchbox'} path '/admin/lunchbox/restaurants/' request <DjangoRequest GET:{}, POST:{}, COOKIES:{'__utma': '199987251.2075077473.1132192348.1132948788.1132956530.51', '__utmb': '199987251', '__utmc': '199987251', '__utmz': '199987251.1132799165.42.4.utmccn=(organic)|utmcsr=google|utmctr=http://lazutkin.com/blog/|utmcmd=organic', 'hotclub': '6e6822babf637fe3c6be306e8d4ce4bc', 'mmrepeat1011': 'true', 'mmsession1011': '7443543', 'mmtmpsess1011': 'true'}, META:{'DOCUMENT_ROOT': '/home/elazutkin/lazutkin.com', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_COOKIE': 'hotclub=6e6822babf637fe3c6be306e8d4ce4bc; mmsession1011=7443543; mmrepeat1011=true; __utma=199987251.2075077473.1132192348.1132948788.1132956530.51; __utmz=199987251.1132799165.42.4.utmccn=(organic)|utmcsr=google|utmctr=http://lazutkin.com/blog/|utmcmd=organic; __utmc=199987251; mmtmpsess1011=true; __utmb=199987251', 'HTTP_HOST': 'lazutkin.com', 'HTTP_REFERER': 'http://lazutkin.com/admin/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5', 'HTTP_X_FORWARDED_FOR': '24.1.30.243', 'PATH': '/bin:/usr/bin:/sbin:/usr/sbin', 'PATH_INFO': '/admin/lunchbox/restaurants/', 'PATH_TRANSLATED': '/home/elazutkin/lazutkin.com/admin/lunchbox/restaurants/', 'QUERY_STRING': '', 'REDIRECT_SCRIPT_URI': 'http://lazutkin.com/admin/lunchbox/restaurants/', 'REDIRECT_SCRIPT_URL': '/admin/lunchbox/restaurants/', 'REDIRECT_STATUS': '200', 'REDIRECT_URL': '/admin/lunchbox/restaurants/', 'REMOTE_ADDR': '64.233.173.73', 'REMOTE_PORT': '58069', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/admin/lunchbox/restaurants/', 'SCRIPT_FILENAME': '/home/elazutkin/lazutkin.com/django.fcgi', 'SCRIPT_NAME': '/django.fcgi', 'SCRIPT_URI': 'http://lazutkin.com/admin/lunchbox/restaurants/', 'SCRIPT_URL': '/admin/lunchbox/restaurants/', 'SERVER_ADDR': '64.111.108.128', 'SERVER_ADMIN': 'webmaster@lazutkin.com', 'SERVER_NAME': 'lazutkin.com', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '', 'SERVER_SOFTWARE': 'Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e', 'wsgi.errors': <fcgi.OutputStream object at 0x4087b5ac>, 'wsgi.input': <fcgi.InputStream object at 0x408b3bcc>, 'wsgi.multiprocess': True, 'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> resolver <django.core.urlresolvers.RegexURLResolver object at 0x408b396c> response None self <django.core.handlers.wsgi.WSGIHandler instance at 0x40247cac> urlresolvers <module 'django.core.urlresolvers' from '/home/elazutkin/djsrc/django/core/urlresolvers.pyc'> * /home/elazutkin/djsrc/django/contrib/admin/views/decorators.py in _checklogin 41. """ 42. Decorator for views that checks that the user is logged in and is a staff 43. member, displaying the login page if necessary. 44. """ 45. def _checklogin(request, *args, **kwargs): 46. if not request.user.is_anonymous() and request.user.is_staff: 47. # The user is valid. Continue to the admin page. 48. return view_func(request, *args, **kwargs) ... 49. 50. assert hasattr(request, 'session'), "The Django admin requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.middleware.sessions.SessionMiddleware'." 51. 52. # If this isn't already the login page, display it. 53. if not request.POST.has_key(LOGIN_FORM_KEY): 54. if request.POST: ▶ Local vars Variable Value args () kwargs {'module_name': 'restaurants', 'app_label': 'lunchbox'} request <DjangoRequest GET:{}, POST:{}, COOKIES:{'__utma': '199987251.2075077473.1132192348.1132948788.1132956530.51', '__utmb': '199987251', '__utmc': '199987251', '__utmz': '199987251.1132799165.42.4.utmccn=(organic)|utmcsr=google|utmctr=http://lazutkin.com/blog/|utmcmd=organic', 'hotclub': '6e6822babf637fe3c6be306e8d4ce4bc', 'mmrepeat1011': 'true', 'mmsession1011': '7443543', 'mmtmpsess1011': 'true'}, META:{'DOCUMENT_ROOT': '/home/elazutkin/lazutkin.com', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_COOKIE': 'hotclub=6e6822babf637fe3c6be306e8d4ce4bc; mmsession1011=7443543; mmrepeat1011=true; __utma=199987251.2075077473.1132192348.1132948788.1132956530.51; __utmz=199987251.1132799165.42.4.utmccn=(organic)|utmcsr=google|utmctr=http://lazutkin.com/blog/|utmcmd=organic; __utmc=199987251; mmtmpsess1011=true; __utmb=199987251', 'HTTP_HOST': 'lazutkin.com', 'HTTP_REFERER': 'http://lazutkin.com/admin/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5', 'HTTP_X_FORWARDED_FOR': '24.1.30.243', 'PATH': '/bin:/usr/bin:/sbin:/usr/sbin', 'PATH_INFO': '/admin/lunchbox/restaurants/', 'PATH_TRANSLATED': '/home/elazutkin/lazutkin.com/admin/lunchbox/restaurants/', 'QUERY_STRING': '', 'REDIRECT_SCRIPT_URI': 'http://lazutkin.com/admin/lunchbox/restaurants/', 'REDIRECT_SCRIPT_URL': '/admin/lunchbox/restaurants/', 'REDIRECT_STATUS': '200', 'REDIRECT_URL': '/admin/lunchbox/restaurants/', 'REMOTE_ADDR': '64.233.173.73', 'REMOTE_PORT': '58069', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/admin/lunchbox/restaurants/', 'SCRIPT_FILENAME': '/home/elazutkin/lazutkin.com/django.fcgi', 'SCRIPT_NAME': '/django.fcgi', 'SCRIPT_URI': 'http://lazutkin.com/admin/lunchbox/restaurants/', 'SCRIPT_URL': '/admin/lunchbox/restaurants/', 'SERVER_ADDR': '64.111.108.128', 'SERVER_ADMIN': 'webmaster@lazutkin.com', 'SERVER_NAME': 'lazutkin.com', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '', 'SERVER_SOFTWARE': 'Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e', 'wsgi.errors': <fcgi.OutputStream object at 0x4087b5ac>, 'wsgi.input': <fcgi.InputStream object at 0x408b3bcc>, 'wsgi.multiprocess': True, 'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> view_func <function change_list at 0x4087ab1c> * /home/elazutkin/djsrc/django/contrib/admin/views/main.py in change_list 227. if opts.one_to_one_field: 228. lookup_params.update(opts.one_to_one_field.rel.limit_choices_to) 229. self.lookup_params = lookup_params 230. 231. 232. def change_list(request, app_label, module_name): 233. try: 234. cl = ChangeList(request, app_label, module_name) ... 235. except IncorrectLookupParameters: 236. return HttpResponseRedirect(request.path) 237. 238. c = Context(request, { 239. 'title': cl.title, 240. 'is_popup': cl.is_popup, ▶ Local vars Variable Value app_label 'lunchbox' module_name 'restaurants' request <DjangoRequest GET:{}, POST:{}, COOKIES:{'__utma': '199987251.2075077473.1132192348.1132948788.1132956530.51', '__utmb': '199987251', '__utmc': '199987251', '__utmz': '199987251.1132799165.42.4.utmccn=(organic)|utmcsr=google|utmctr=http://lazutkin.com/blog/|utmcmd=organic', 'hotclub': '6e6822babf637fe3c6be306e8d4ce4bc', 'mmrepeat1011': 'true', 'mmsession1011': '7443543', 'mmtmpsess1011': 'true'}, META:{'DOCUMENT_ROOT': '/home/elazutkin/lazutkin.com', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_COOKIE': 'hotclub=6e6822babf637fe3c6be306e8d4ce4bc; mmsession1011=7443543; mmrepeat1011=true; __utma=199987251.2075077473.1132192348.1132948788.1132956530.51; __utmz=199987251.1132799165.42.4.utmccn=(organic)|utmcsr=google|utmctr=http://lazutkin.com/blog/|utmcmd=organic; __utmc=199987251; mmtmpsess1011=true; __utmb=199987251', 'HTTP_HOST': 'lazutkin.com', 'HTTP_REFERER': 'http://lazutkin.com/admin/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5', 'HTTP_X_FORWARDED_FOR': '24.1.30.243', 'PATH': '/bin:/usr/bin:/sbin:/usr/sbin', 'PATH_INFO': '/admin/lunchbox/restaurants/', 'PATH_TRANSLATED': '/home/elazutkin/lazutkin.com/admin/lunchbox/restaurants/', 'QUERY_STRING': '', 'REDIRECT_SCRIPT_URI': 'http://lazutkin.com/admin/lunchbox/restaurants/', 'REDIRECT_SCRIPT_URL': '/admin/lunchbox/restaurants/', 'REDIRECT_STATUS': '200', 'REDIRECT_URL': '/admin/lunchbox/restaurants/', 'REMOTE_ADDR': '64.233.173.73', 'REMOTE_PORT': '58069', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/admin/lunchbox/restaurants/', 'SCRIPT_FILENAME': '/home/elazutkin/lazutkin.com/django.fcgi', 'SCRIPT_NAME': '/django.fcgi', 'SCRIPT_URI': 'http://lazutkin.com/admin/lunchbox/restaurants/', 'SCRIPT_URL': '/admin/lunchbox/restaurants/', 'SERVER_ADDR': '64.111.108.128', 'SERVER_ADMIN': 'webmaster@lazutkin.com', 'SERVER_NAME': 'lazutkin.com', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '', 'SERVER_SOFTWARE': 'Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e', 'wsgi.errors': <fcgi.OutputStream object at 0x4087b5ac>, 'wsgi.input': <fcgi.InputStream object at 0x408b3bcc>, 'wsgi.multiprocess': True, 'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> * /home/elazutkin/djsrc/django/contrib/admin/views/main.py in __init__ 58. self.get_ordering() 59. self.query = request.GET.get(SEARCH_VAR,'') 60. self.get_lookup_params() 61. self.get_results(request) 62. self.title = (self.is_popup 63. and _('Select %s') % self.opts.verbose_name 64. or _('Select %s to change') % self.opts.verbose_name) 65. self.get_filters(request) ... 66. self.pk_attname = self.lookup_opts.pk.attname 67. 68. def get_filters(self, request): 69. self.filter_specs = [] 70. if self.lookup_opts.admin.list_filter and not self.opts.one_to_one_field: 71. filter_fields = [self.lookup_opts.get_field(field_name) \ ▶ Local vars Variable Value app_label 'lunchbox' module_name 'restaurants' request <DjangoRequest GET:{}, POST:{}, COOKIES:{'__utma': '199987251.2075077473.1132192348.1132948788.1132956530.51', '__utmb': '199987251', '__utmc': '199987251', '__utmz': '199987251.1132799165.42.4.utmccn=(organic)|utmcsr=google|utmctr=http://lazutkin.com/blog/|utmcmd=organic', 'hotclub': '6e6822babf637fe3c6be306e8d4ce4bc', 'mmrepeat1011': 'true', 'mmsession1011': '7443543', 'mmtmpsess1011': 'true'}, META:{'DOCUMENT_ROOT': '/home/elazutkin/lazutkin.com', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_COOKIE': 'hotclub=6e6822babf637fe3c6be306e8d4ce4bc; mmsession1011=7443543; mmrepeat1011=true; __utma=199987251.2075077473.1132192348.1132948788.1132956530.51; __utmz=199987251.1132799165.42.4.utmccn=(organic)|utmcsr=google|utmctr=http://lazutkin.com/blog/|utmcmd=organic; __utmc=199987251; mmtmpsess1011=true; __utmb=199987251', 'HTTP_HOST': 'lazutkin.com', 'HTTP_REFERER': 'http://lazutkin.com/admin/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5', 'HTTP_X_FORWARDED_FOR': '24.1.30.243', 'PATH': '/bin:/usr/bin:/sbin:/usr/sbin', 'PATH_INFO': '/admin/lunchbox/restaurants/', 'PATH_TRANSLATED': '/home/elazutkin/lazutkin.com/admin/lunchbox/restaurants/', 'QUERY_STRING': '', 'REDIRECT_SCRIPT_URI': 'http://lazutkin.com/admin/lunchbox/restaurants/', 'REDIRECT_SCRIPT_URL': '/admin/lunchbox/restaurants/', 'REDIRECT_STATUS': '200', 'REDIRECT_URL': '/admin/lunchbox/restaurants/', 'REMOTE_ADDR': '64.233.173.73', 'REMOTE_PORT': '58069', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/admin/lunchbox/restaurants/', 'SCRIPT_FILENAME': '/home/elazutkin/lazutkin.com/django.fcgi', 'SCRIPT_NAME': '/django.fcgi', 'SCRIPT_URI': 'http://lazutkin.com/admin/lunchbox/restaurants/', 'SCRIPT_URL': '/admin/lunchbox/restaurants/', 'SERVER_ADDR': '64.111.108.128', 'SERVER_ADMIN': 'webmaster@lazutkin.com', 'SERVER_NAME': 'lazutkin.com', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '', 'SERVER_SOFTWARE': 'Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e', 'wsgi.errors': <fcgi.OutputStream object at 0x4087b5ac>, 'wsgi.input': <fcgi.InputStream object at 0x408b3bcc>, 'wsgi.multiprocess': True, 'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> self <django.contrib.admin.views.main.ChangeList object at 0x408aadcc> * /home/elazutkin/djsrc/django/contrib/admin/views/main.py in get_filters 68. def get_filters(self, request): 69. self.filter_specs = [] 70. if self.lookup_opts.admin.list_filter and not self.opts.one_to_one_field: 71. filter_fields = [self.lookup_opts.get_field(field_name) \ 72. for field_name in self.lookup_opts.admin.list_filter] 73. for f in filter_fields: 74. spec = FilterSpec.create(f, request, self.params) 75. if spec.has_output(): ... 76. self.filter_specs.append(spec) 77. self.has_filters = bool(self.filter_specs) 78. 79. def get_query_string(self, new_params={}, remove=[]): 80. p = self.params.copy() 81. for r in remove: ▶ Local vars
by , 19 years ago
Attachment: | list_filter_spec_fix.patch added |
---|
fix for oddness of error message from this ticket
comment:5 by , 19 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Summary: | New admin is broken by my model. → [patch] incorrect `list_filter` field error message a bit stranger than necessary |
Attached a patch based on rjwittam's suggestion from IRC for this issue; it seems that the new-admin merge made the error from having an incorrect field type included in list_filter
a bit stranger than it needed to be.
comment:6 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Note:
See TracTickets
for help on using tickets.
Can you post just the relevant info inline here in a comment? The attached file sure isn't the prettiest way of trying to decipher the problem. :-)