Take the 2-minute tour ×

I'd have a problem with custom AdminSite - my apps are not visible at the admin index and not accessible if i type appropriate URL to view their models. My problem is very similar to this: http://groups.google.com/group/django-users/browse_thread/thread/881feb7eef80853a but it's kind of reverse problem - the bundled models are visible, but my custom are not.

My project named magic and it have app. named nullt


from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import UserAdmin, GroupAdmin 

class MagicAdmin(AdminSite):

admin_site = MagicAdmin()

admin_site.register(Group, GroupAdmin)
admin_site.register(User, UserAdmin)


from magic.admin import admin_site
admin_site.register(Host, HostAdmin)
admin_site.register(Client, ClientAdmin)


from django.conf.urls.defaults import * #@UnusedWildImport
from magic.admin import admin_site

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

P.S. I'm using Django 1.2.2 installed with easy_install and Python 2.6.5 from Ubuntu 10.04 x86_64

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

By default, the following two lines are commented in a new project's urls.py:

from django.contrib import admin

From django/contrib/admin/__init__.py:

def autodiscover():
    Auto-discover INSTALLED_APPS admin.py modules and fail silently when
    not present. This forces an import on them to register any admin bits they
    may want.

This call may be necessary, even if you have a custom admin.

share|improve this answer
I read in the Django 1.2 documentation ((docs.djangoproject.com/en/1.2/ref/contrib/admin) that there is really no need to use autodiscover when using your own AdminSite instance since you will likely be importing all the per-app admin.py modules in your myproject.admin module. But actually the autodiscover() did the trick and I see my custom models in my custom admin :) Thank you. –  Dmitry Musatov Nov 15 '10 at 10:52
add comment

You can'not use the standard autodiscover function, when you are using your custom AdminSite instance.

I've described here some thick that may help you.


share|improve this answer
add comment

Your Answer


