I'm working through the tutorial and was setting up the admin site for the 
polls app.  I noticed in the "Select Poll to Change" section that it was 
showing "poll object" rather than "what's up" or the question associated 
with the poll.  Same is true on the Choice area of admin, the dropdown for 
polls just shows a number of poll objects rather than the names.  I can't 
seem to find a difference in my code versus the tutorial.  Below is my 
code.  Any help would be appreciated.
*mysite/polls/admin.py*
from polls.models import Poll, Choice
from django.contrib import admin

class PollAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields': ['question']}),
        ('Date information', {'fields': ['pub_date'], 'classes': 
['collapse']}),
    ]
    
admin.site.register(Poll, PollAdmin)
admin.site.register(Choice)

*mysite/polls/models.py*
from django.db import models

class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(max_length=200)
    votes = models.IntegerField()*

mysite/settings.py* (just the changed text)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 
'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 
'/Users/Sam/dev/django/mysite/mysite1.sqlite',                      # Or 
path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for 
localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. 
Not used with sqlite3.
    }
}

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
    'polls',
)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/2-CC0B8PXvYJ.
To post to this group, send email to django-users@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.

<<attachment: Screen Shot 2012-04-10 at 9.45.32 PM.png>>

Reply via email to