Search code examples
pythondjangodjango-admindjango-allauthdjango-3.1

hide django-allauth model from admin page


I want hide all django-allauth model from admin page

enter image description here

after I see the source code in github I see it use three models SocialAccount, SocialToken and SocialApp.

now I use this to hide model from admin page and it works when I try to use it on my own model but when I use it to hide django-allauth model it doesnt work, I think I stuck on the part from x import SocialAccount, SocialToken, SocialApp

because the error message is always like this

ImportError: cannot import name 'SocialAccount' from 'x'

I dont know the x part what to import, where to import


Solution

  • this works.

    from allauth.socialaccount.models import SocialAccount, SocialApp, SocialToken
    
    admin.site.unregister(SocialAccount)
    admin.site.unregister(SocialApp)
    admin.site.unregister(SocialToken)