Opened 14 years ago
Closed 14 years ago
#15288 closed (worksforme)
ManyToManyField doesn't highlight currently selected items in Admin where target is a proxy object.
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.2 |
Severity: | 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've implemented my own single-table inheritance by creating a base class with all the fields I need, plus a 'type' field to contain the subclass objects should be instantiated as.
I've got two subclasses which are proxies for the main class, each with a custom model manager to filter results by the appropriate class.
This works almost everywhere except in the admin area. I've got a ManyToMany relationship defined on a class that references one of these proxy objects.
When I select some of these proxy objects in the admin and save the form, the database is correctly updated, but the select form widget doesn't highlight the selected items.
This affects at least django 1.2.3 to 1.2.4.
I tried to follow your instructions and wrote the following test case, but everything seems to work as expected (i.e. the saved options are highlighted in the M2M widget):
Models:
Admin:
If I've missed something, then please reopen this ticket and please also provide a detailed test case.