Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django ignoring admin.py

Tags:

django

admin

I am trying to enable the admin for my app. I managed to get the admin running, but I can't seem to make my models appear on the admin page. I tried following the tutorial (here) which says:

(Quote)

Just one thing to do: We need to tell the admin that Poll objects have an admin interface. To do this, create a file called admin.py in your polls directory, and edit it to look like this:

from polls.models import Poll from
django.contrib import admin

admin.site.register(Poll)

(end quote)

I added an admin.py file as instructed, and also added the following lines into urls.py:

from django.contrib import admin

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

but it appears to have no effect. I even added a print 1 at the first line of admin.py and I see that the printout never happens, So I guess django doesn't know about my admin.py. As said, I can enter the admin site, I just don't see anything other than "groups", "users" and "sites". What step am I missing?

like image 422
olamundo Avatar asked Dec 28 '10 12:12

olamundo


1 Answers

You need to ensure you have app containing Poll listed in INSTALLED_APPS :)

like image 65
Silver Light Avatar answered Nov 22 '22 20:11

Silver Light