Change admin by default of django but without redirecting the models to the default admin

0

I have a custom administrator, but when I click on a model, it redirects me to the default administrator django, so it would not make sense to do a custom admin, thanks for your collaboration.

This is my custom admin is in myapp / admin.py, in this case user / admin.py, I just want the user logged in without being a super user visualize the administration of their foundation.

class AdminFundacion(AdminSite):
    site_header = "Administracion de fundación"    
    def has_permission(self, request):
        if request.user.is_active : 
            if request.user.rol=='1' :
                self.index_title="Bienvenido a la gestion de "+str(request.user.fundacion)              
                return request.user.is_active

AdminFundacion = AdminFundacion(name='fundacion-admin')
AdminFundacion.register(Fundacion,FundacionAdmin)

This is your respective URL in myapp / url.py

from users.admin import AdminFundacion
url(r'^fundacion-admin/$', AdminFundacion.urls),

When I register the model in the custom admin (AdminFundation), without registering the model in the default admin:

admin.site.register(Fundacion, FundacionAdmin)

This appears to me, as the model is disabled:

When I register the model in the default admin, the model is enabled but when I click on the model, it loses the url user / fundacion-admin / or app / fundacion-admin / and redirects it to admin / app or admin / users in this case

What can I do so that I can only manage from the custom admin?.

    
asked by Omar Lopez 24.09.2018 в 23:29
source

0 answers