Saturday, October 8, 2011

StackedLinein and 404 error

Working on django tutorial here: https://docs.djangoproject.com/en/dev/intro/tutorial02/
and I am stuck where they start the instructions about Stackedlnline.
I keep getting the following error:

Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/polls/choice/add/

Using the URLconf defined in mysite.urls, Django tried these URL
patterns, in this order:

^admin/ ^$ [name='index']
^admin/ ^logout/$ [name='logout']
^admin/ ^password_change/$ [name='password_change']
^admin/ ^password_change/done/$ [name='password_change_done']
^admin/ ^jsi18n/$ [name='jsi18n']
^admin/ ^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$
^admin/ ^(?P<app_label>\w+)/$ [name='app_list']
^admin/ ^polls/poll/
^admin/ ^auth/group/
^admin/ ^sites/site/
^admin/ ^auth/user/

The current URL, admin/polls/choice/add/, didn't match any of these.

My admin.py and urls.py are shown below

Can some one take a look and tell me where I am going wrong?

*****admin.py******

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

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

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

admin.site.register(Poll, PollAdmin)

*****urls.py*****

from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.foo.urls')),

# Uncomment the admin/doc line below and add
'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
)

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment