Actually the minimum requirement for the application to appear in admin is
this (here in docs:
https://docs.djangoproject.com/en/dev/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin):


admin.py:

from django.contrib import admin
from mysite.polls.models import Poll, Choice

# `register()` optionally takes a second argument of a `admin.ModelAdmin`
object
admin.site.register(Poll)
admin.site.register(Choice)


Though as Sandeep put in this code --  in this case you probably would like
the `polls.Choice` inline, which would look like this:

admin.py:

from django.contrib import admin
from mysite.polls.models import Poll, Choice

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

class PollAdmin(admin.ModelAdmin):
        inlines = [ChoiceInline]

admin.site.register(Poll, PollAdmin)



---
Elena :)
@elequ
04022 90172



On Fri, Nov 2, 2012 at 2:42 PM, Sandeep kaur <mkaurkha...@gmail.com> wrote:

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

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