In your urls. py make sure you have: from django.contrib import admin admin.autodiscover()
and that you've uncommented the (r'^admin/', include(admin.site.urls)), in the tuple: urlpatterns = patterns. On Apr 9, 2010, at 8:44 AM, Sheena wrote: > Hey hey. I'm a little new to Django so I've been following through the > Django Book v2 and I'm having trouble adding my models to the admin > site. I'm pretty sure I've followed instructions correctly, I've also > tried following some random advice I found to no avail. Any help would > be greatly appreciated. Below are some code snippets: > > from models.py: > class Publisher(models.Model): > name = models.CharField(max_length=30) > address = models.CharField(max_length=50) > city = models.CharField(max_length=60) > state_province = models.CharField(max_length=30) > country = models.CharField(max_length=50) > website = models.URLField() > > def __unicode__(self): > return self.name > > class admin: > pass > the last two lines don't seem to change anything. > > form settings.py > INSTALLED_APPS = ( > 'django.contrib.auth', > 'django.contrib.contenttypes', > #'django.contrib.sessions', > 'django.contrib.admin', > #'django.contrib.comments', > #'django.contrib.sites', > 'newProj.books', > ) > MIDDLEWARE_CLASSES = ( > 'django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > ) > > DATABASE_ENGINE = 'sqlite3' > DATABASE_NAME = > os.path.join(os.path.dirname(__file__),'testDB').replace('\\','/') > DATABASE_USER = '' # Not used with sqlite3. > DATABASE_PASSWORD = '' # Not used with sqlite3. > DATABASE_HOST = '' # Not used with sqlite3. > DATABASE_PORT = '' # Set to empty string for default. Not > used > > And finally from admin.py > class AuthorAdmin(admin.ModelAdmin): > pass > admin.site.register(Author, AuthorAdmin) > admin.site.register(Publisher) > admin.site.register(Book) > > Any help would be greatly appreciated > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.