Opened 19 years ago
Closed 19 years ago
#525 closed defect (fixed)
list_filter doesn't work with models which primary key is not named 'id'
Reported by: | nesh <nesh [at] studioquattro [dot] co [dot] yu> | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | contrib.admin | Version: | |
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 |
Description
I'm using package model and when I'm set list_filter to 'package' I'm getting following traceback.
It seems to that filter code doesn't work with models which primary key is not named 'id'.
There's been an error: Traceback (most recent call last): File "/Users/nesh/devel/django/django/core/handlers/base.py", line 64, in get_response response = callback(request, **param_dict) File "/Users/nesh/devel/django/django/views/admin/main.py", line 211, in change_list filter_template.append('%r\n' % \ AttributeError: 'Package' object has no attribute 'id'
Note:
See TracTickets
for help on using tickets.
Error is with Many-to-many fields.
django/views/admin/main.py
: lines 920, 922 tooWhy not adding a
__id__
method that returnsself.id
by default and, for example,self.myId
when specified ?