Created
September 20, 2012 22:23
-
-
Save fabiocerqueira/3758726 to your computer and use it in GitHub Desktop.
Custom Admin Site Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf.urls import patterns, include, url | |
from django.views.decorators.cache import never_cache | |
from django.contrib import admin | |
# voce pode por isso em outra arquivo e importar aqui | |
class CustomAdminSite(admin.AdminSite): | |
@never_cache | |
def index(self, request, extra_context=None): | |
ret = super(CustomAdminSite, self).index(request, extra_context) | |
# SEU CODIGO AQUI | |
return ret | |
admin.site = CustomAdminSite() # talvez essa não seja uma boa solução | |
admin.autodiscover() | |
urlpatterns = patterns('', | |
url(r'^admin/', include(admin.site.urls)), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment