質問

How to hide some of the models?

I need them registred to be used by other models, while calling via FK or nested etc.

I found one solution which is rather much about view layer of (MVC) http://blog.jholster.com/post/1534211028/hide-app-names-in-django-admin

I would like to set it in admin.py, that some of registred models are hidden.

役に立ちましたか?

解決

If the models are in your application, just don't register them in the first place. If the model is in a third party app like the django.contrib.auth then use AdminSite unregister method. You can put this in any admin.py or urls.py important is to be discovered by the admin.autodiscover.

# admin.py
from django.contrib.auth.models import User

admin.site.unregister(User)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top