@Sheena,

sorry -- I didnt read all of your email -- I think if you've got it all in 
admin.py make sure you're importing admin from django.contrib.

To activate the admin interface though you need to do:

1. Add 'django.contrib.admin' to the INSTALLED_APPS setting (which you did)
2. Make sure INSTALLED_APPS contains 'django.contrib.auth, contettypes, and 
sessions  (I see sessions is commented out on yours.
3. Middle ware classes needs to contain 
'django.middleware.common.CommomMiddleware, 
'django.contrib.sessions.middlewarae.SessionMiddleWare, and 
django.contrib.auth.middleware.AuthenticationMiddleware.

run python manage.py syncdb

then make sure that you have this in urls.py file:

from django.contrib import admin
admin.autodiscover()

#include this URLPattern...
urlpatterns = patterns(' ',
        # ...
        (r'^admin/', include(admin.site.urls)),
        # ...
)

Hope this helps!



but you will still need to make sure that you have
On Apr 9, 2010, at 9:13 AM, Steven Elliott Jr wrote:

> 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.

-- 
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.

Reply via email to