I added a model to admin via admin.site.register, and it does not show up in admin. Sice admin is so "It just works", I have no idea of how to debug this. POinters?
Have you added the application to your installed apps? That has happened to me both one and two times. :) Otherwise it would be useful for us to see the code to help you.
After adding and registering your admin:
# app/admin.py
class YourModelAdmin(admin.ModelAdmin):
pass
admin.site.register(YourModel, YourModelAdmin)
Make sure your app is in your project settings.py
:
# settings.py
INSTALLED_APPS = (
# other apps ...
'app',
)
Sync your project for that model if you have not done so already:
python manage.py syncdb
Restart your server, CTRL-C
:
python manage.py runserver
Also make sure there are no syntax errors in your admin.py or anything. That can cause an app to fail to be registered with the AdminSite.
I think the checklist in Thierry's answer is almost definitive, but make sure that urls.py
contains admin.autodiscover()
to load INSTALLED_APPS
admin.py modules.
# urls.py
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
('^admin/', include(admin.site.urls)),
)
More info in the django docs.
I have the experience, that sometimes after changing an admin.py the dev-sever won't be restarted. in that case touch settings.py
helps.
comment out the some lines in urls.py see docs for more details
admin.autodiscover()
urlpatterns = patterns('', ('^admin/', include(admin.site.urls)), )