views:

324

answers:

5

I've read all the other threads but I still don't get why my apps are not showing up in Django admin. Everything else works fine.

My apps are in settings.py

I have admin.autodiscover in my root urls.py file

from django.conf.urls.defaults import *
from django.conf import settings

from django.views.generic.simple import direct_to_template

from django.contrib import admin

admin.autodiscover()



urlpatterns = patterns('',
url(r'^$', direct_to_template, {
    "template": "homepage.html",
}, name="home"),

url(r'^admin/invite_user/$', 'signup_codes.views.admin_invite_user', name="admin_invite_user"),
url(r'^account/signup/$', "signup_codes.views.signup", name="acct_signup"),

(r'^account/', include('account.urls')),
(r'^profiles/', include('basic_profiles.urls')),
(r'^notices/', include('notification.urls')),
(r'^announcements/', include('announcements.urls')),
(r'^tagging_utils/', include('tagging_utils.urls')),
(r'^attachments/', include('attachments.urls')),
(r'^comments/', include('threadedcomments.urls')),
#
(r'^wayfinder/', include('wayfinder.urls')),
(r'^site/', include('jsite.urls')),
(r'^kiosk/', include('kiosk.urls')),
(r'^navigator/', include('navigator.urls')),
(r'^location/', include('location.urls')),
(r'^event/', include('event.urls')),
#(r'^news_reader/', include('news_reader.urls')),
#(r'^weather_reader/', include('weather_reader.urls')),

(r'^admin/(.*)', admin.site.root),
)

if settings.SERVE_MEDIA:
urlpatterns += patterns('',
    (r'^site_media/', include('staticfiles.urls')),
)

All my apps have an admin.py file containing something like

from django.contrib import admin
from event.models import Event

class EventAdmin(admin.ModelAdmin):
    list_display = (
                'short_name',
                'long_name',
                'locations',
                'categories',
                'description',
                'phone',
                'email',
                'url_source',
                'url_location',
                'external_ref',
                'show_event'
            )

admin.site.register(Event, EventAdmin)

And I have restarted the server over and over ;-)

I am building on top of Pinax, but from my reading, it shouldn't change anything. Any clue what might be wrong ?

A: 

Are you logging in to admin as a superuser? If not, it could be a permissions problem.

Antony Hatchkins
Yes I am, I can log in to the admin, but I do not see the apps I've added..
PhilGo20
Not everyone who can log in to admin has is_superuser right. Doublecheck that you do.
Antony Hatchkins
Yes, logged in with super_user privileges
PhilGo20
+2  A: 

Do you have your apps in the INSTALLED_APPS section in settings.py? Make sure it has your apps listed there. My section reads

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'squick.items',
'cowsite.search',
'cowsite.posts',

)

for instance. I'm pretty sure for security, they won't show up in the admin unless they are in installed apps. I think I had this same issue, where I couldn't get cowsite to show up in the admin.

The Django docs say about the admin page: "By default, it displays all the apps in INSTALLED_APPS that have been registered with the admin application, in alphabetical order"

Alex JL
the apps are in the installed_apps list. I should not that the whole project work, all the models from my apps are generated correctly and works in different views and 10s of templates, but I don't see them in the admin...
PhilGo20
A: 

Not sure which version of django you're using but the current docs suggest including the admin urls.

 ('^admin/', include(admin.site.urls))
czarchaic
I think that comes from pinax. The problem is not acessing the admin, that i can. It's really having acess to my app's models. Thanks
PhilGo20
A: 

You didn't answer Antony's question. Are you logging in as a superuser, or at least with a user with add/edit rights for the applications? If not, you won't see them.

Daniel Roseman
I am and I see all other models and apps...
PhilGo20
A: 

Dear PhilGo20

By coincidence I had the same problem this morning. Briefly, this is what worked for me (see references for details):

In the top level directory of MyApp (ie same directory as models.py, etc.) I added a python module admin.py, containing:

from models import ThisModel, ThatModel
from django.contrib import admin

admin.site.register(ThisModel)
admin.site.register(ThatModel)

Then in mysite directory I did syncdb and runserver, and ThisModel and ThatModel were in the admin interface.

Does that work for you?

Best wishes

Ivan

** References

(I am a new member so I am allowed to post one hyperlink only!)

Django tutorial: Make the poll app modifiable in the admin

There was also a query on the Pinax google group recently titled, "How to add my app to Admin in a Pinax project?"

Ivan
if you look at my question, I already do that. Thanks
PhilGo20