Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apps won't show in Django admin

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 ?

like image 611
philgo20 Avatar asked Jan 04 '10 21:01

philgo20


People also ask

Why is Django admin not working?

'django-admin' is not recognized as an internal or external command, operable program or batch file. To fix this, first close the terminal window and relaunch it with administrator privileges. Once you launch the elevated terminal window change directory to where you wish to start your Django project.

How do I give permission to admin in Django?

The Django admin site uses permissions as follows: Access to view objects is limited to users with the “view” or “change” permission for that type of object. Access to view the “add” form and add an object is limited to users with the “add” permission for that type of object.


2 Answers

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"

like image 96
JAL Avatar answered Sep 28 '22 01:09

JAL


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

like image 31
Antony Hatchkins Avatar answered Sep 28 '22 01:09

Antony Hatchkins