On Fri, Nov 2, 2012 at 12:29 AM, Mihail Mihalache
<
mihalach...@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:
mkaur...@gmail.com
Blog:
sandymadaan.wordpress.com