On Fri, Nov 2, 2012 at 12:29 AM, Mihail Mihalache
<mihalache_mih...@yahoo.com> wrote:
> I have followed the django tutorial up to part 2 -
> https://docs.djangoproject.com/en/1.4/intro/tutorial02/ .
> Everything worked fine, until I couldn't see the Polls entry on the admin
> page. I have checked that I have done everything mentioned in the tutorial.
> I get no error whatsoever. I have no idea what's wrong.
> There is a polls entry INSTALLED_APPS.
>
Your admin.py file should have this code :
-------------------------------------------------------------------------
from mysite.polls.models import Poll
from django.contrib import admin
from mysite.polls.models import Choice


class ChoiceInline(admin.TabularInline):
    model = Choice
    extra = 3

class PollAdmin(admin.ModelAdmin):
        fieldsets = [
        (None,               {'fields': ['question']}),
        ('Date information', {'fields': ['pub_date']}),
    ]
        inlines = [ChoiceInline]
        list_display = ('question', 'pub_date')
        list_filter = ['pub_date']
        search_fields = ['question']

admin.site.register(Poll, PollAdmin)
-----------------------------------------------------------------------------

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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.

Reply via email to