Changes between Initial Version and Version 1 of Ticket #28384


Ignore:
Timestamp:
Jul 11, 2017, 9:00:23 AM (7 years ago)
Author:
Tim Graham
Comment:

Bisected to 8f30556329b64005d63b66859a74752a0b261315.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28384

    • Property Triage Stage UnreviewedAccepted
    • Property Summary ModelAdmin.lookup_allowed() incorrectly raises DisallowedModelAdminLookup lookup with foreign key as primaryModelAdmin.lookup_allowed() incorrectly raises DisallowedModelAdminLookup lookup with foreign key as primary key
  • Ticket #28384 – Description

    initial v1  
    1 Wrote a failing test to demonstrate - same test/code passes on 1.8
     1Wrote a failing test for `tests/modeladmin/tests.py` to demonstrate - same test/code passes on 1.8
    22{{{
    33@isolate_apps('modeladmin')
     
    2525}}}
    2626
    27 I think this is caused by the admin thinking that having a foreign key field as a primary key is the same as concrete inheritance. So when you try and check lookups for {{{restaurant__place__country}}} it thinks 'place' is the concrete parent of 'restaurant' and shortcuts it to {{{restaurant__country}}} which isn't in 'list_filter'. And you can't add {{{restaurant__country}}} to list_filter because country isn't actually on restaurant.
     27I think this is caused by the admin thinking that having a foreign key field as a primary key is the same as concrete inheritance. So when you try and check lookups for `restaurant__place__country` it thinks 'place' is the concrete parent of 'restaurant' and shortcuts it to `restaurant__country` which isn't in 'list_filter'. And you can't add `restaurant__country` to `list_filter` because country isn't actually on restaurant.
Back to Top