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
magic/admin.py:
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):
pass
admin_site = MagicAdmin()
admin_site.register(Group, GroupAdmin)
admin_site.register(User, UserAdmin)
magic/nullt/admin.py
from magic.admin import admin_site
...
admin_site.register(Host, HostAdmin)
admin_site.register(Client, ClientAdmin)
...
magic/urls.py
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
By default, the following two lines are commented in a new project's urls.py:
from django.contrib import admin
admin.autodiscover()
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With