Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the Admin UI be used without the user authenticating in Django 1.3?

I was wondering if there's an easy way to configure the Django Admin UI (eg at http://mysite.com/admin) so that I don't need to authenticate/login?

I've tried tweaking urls.py but couldn't get it to bypass the login screen:

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
)

I'd like to go to http://mysite.com/admin and see the list of django objects without having to login.

Thanks.

like image 636
user1676844 Avatar asked Nov 13 '22 08:11

user1676844


1 Answers

  • Django admin framework uses 'is_staff' flag on the 'User' object to verify the permission to use admin site.
  • So it needs an user to be authenticated to verify his admin related permissions.
  • If you want to disable this, you have to override the 'index' method of the admin site.
  • It is available at django.contrib.admin.sites.

def index(self, request, extra_context=None):

     """
     Displays the main admin index page, which lists all of the installed
     apps that have been registered in this site.
     """
like image 188
Sivasubramaniam Arunachalam Avatar answered Nov 15 '22 05:11

Sivasubramaniam Arunachalam