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