django-polymorphic icon indicating copy to clipboard operation
django-polymorphic copied to clipboard

PolymorphicChildModelAdmin with show_in_index=False in Django Admin with nav_sidebar

Open megges2000 opened this issue 4 years ago • 3 comments

Links to PolymorphicChildModelAdmin are as default (or with show_in_index=False) not shown on the index admin page. But in the newer Django Version there is also a sidebar which is shown per default, if you are in some modelsAdmin-Page. In that Sidebar the links to the PolymorphicChildModelAdmin are still shown, i think this is falsely. Or am i missing something?

megges2000 avatar Sep 14 '21 21:09 megges2000

Same here

adamwojt avatar Dec 05 '21 03:12 adamwojt

Has anyone found a workaround for this ? I guess the list is pulled out from something like AdminSite._registry but not sure what could be the function to overwrite

VietHo avatar Aug 11 '22 21:08 VietHo

@VietHo you can hide your model with has_module_permission:

@admin.register(Child1)
class Child1Admin(PolymorphicChildModelAdmin)
    base_model=Child1

    def has_module_permission(self, request):
        return False

pauk-slon avatar Aug 13 '22 22:08 pauk-slon