Uncomment:  #'django.contrib.sessions',

make sure to import admin from django.contrib and turn admin.autodiscover()

and yes, error messages would be helpful... if any.


On Apr 9, 2010, at 10:32 AM, Stuart wrote:

> What you have looks about right. What result are you getting? An error
> message?
> 
> 
> --Stuart
> 
> On Apr 9, 7:44 am, Sheena <sheena.oconn...@gmail.com> 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.

Reply via email to