﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
168	history() in django/views/admin/main.py makes assumptions about the object's key name	clintecker@…	Adrian Holovaty	"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' 
}}}"	defect	closed	contrib.admin		major	fixed	history		Accepted	0	0	0	0	0	0
