home / django_tickets / tickets

tickets: 168

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
168 2005-07-23 02:57:40 2007-07-03 23:04:31 2022-03-06 03:19:56.018772 Accepted closed contrib.admin defect major   fixed history() in django/views/admin/main.py makes assumptions about the object's key name Normally the ID of an object is "id", except in cases like mine where I'd redefined the key to be something like list: {{{ "meta.AutoField('item_id','Item ID',primary_key=True,unique=True)," }}} When pulling up the history of a record in the administrative interface, the function history() in django/views/admin/main.py is called and an assumption is made on line 1080: {{{ "obj = mod.get_object(id__exact=object_id)" }}} In my case, I believe that it should be (it cannot be hardcoded like this, obviously this needs to be dynamic): {{{ "obj = mod.get_object(item_id__exact=object_id)" }}} Here's the exact text of the traceback I get: {{{ There's been an error: Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 190, in get_response return callback(request, **param_dict) File "/usr/local/lib/python2.4/site-packages/django/views/admin/main.py", line 1080, in history obj = mod.get_object(id__exact=object_id) File "/usr/local/lib/python2.4/site-packages/django/core/meta.py", line 87, in _curried return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items())) File "/usr/local/lib/python2.4/site-packages/django/core/meta.py", line 1035, in function_get_object obj_list = function_get_list(opts, klass, **kwargs) File "/usr/local/lib/python2.4/site-packages/django/core/meta.py", line 1057, in function_get_list select, sql, params = function_get_sql_clause(opts, **kwargs) File "/usr/local/lib/python2.4/site-packages/django/core/meta.py", line 1235, in function_get_sql_clause tables2, join_where2, where2, params2, _ = _parse_lookup(kwargs.items(), opts) File "/usr/local/lib/python2.4/site-packages/django/core/meta.py", line 1224, in _parse_lookup _throw_bad_kwarg_error(kwarg) File "/usr/local/lib/python2.4/site-packages/django/core/meta.py", line 1126, in _throw_bad_kwarg_error raise TypeError, "got unexpected keyword argument '%s'" % kwarg TypeError: got unexpected keyword argument 'id__exact' }}} adrian clintecker@gmail.com history 0 0 0 0 0 0
Powered by Datasette · Queries took 0.949ms