Using autocomplete feature in Django admin without showing related model in the left sidebar

(Cross-posting with StackOverflow)


My main model ObjetArchi has several related models, connected through foreign keys. To avoid loading a long list of values and scrolling infinitely through it, I’m using the autocomplete feature in the ObjetArchi admin interface. Related models have to be registered for the autocomplete to work, but I’d like them not to be shown in the left sidebar. Is there a way to hide them while still being able to edit them through the main model if needed?

Thanks for your help!

Sure, you should use has_module_permission in your related models, like this:

class RelatedModelAdmin(admin.ModelAdmin):
    def has_module_permission(self, request):
        return False
1 Like