#2145: list_filter not available if model contains OneToOneField
------------------------+---------------------------------------------------
Reporter: danielr | Owner: adrian
Status: reopened | Component: Admin interface
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 1 | Needs_better_patch: 1
------------------------+---------------------------------------------------
Changes (by Jeremy Dunck <[EMAIL PROTECTED]>):
* has_patch: 0 => 1
Comment:
I've tried to work up a test, but have run into trouble due to tight
coupling.
I think it may be possible using the web client, but a simple model-based
regression test doesn't seem possible. It looks like no other tests
require the web client, so I'm reluctant to add the first one.
I think the trivial patch given is wrong, in that it misses the point. I
think the real problem is that one_to_one_rel is being contributed to the
related class, e.g. "place" when it ought to be contributed to the
referencing class (e.g. restaurant). I think one_to_one_field is
basically just supposed to be a well-known name, like self.pk.
I'll attach a different patch in a moment, but note the patch solved two
problems for me: this one, and the fact that limit_choices_to on
Restaurant was causing the *Place* change list to be filtered based on the
limit_choices_to kwargs.
This pointed me in what I think is the right direction: one_to_one_field
should be contributed to restaurant, not place.
All existing tests still pass with the new patch.
--
Ticket URL: <http://code.djangoproject.com/ticket/2145#comment:11>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---