开发者

Generic Edit URL not working in Django

开发者 https://www.devze.com 2023-03-16 04:08 出处:网络
I am using Django generic View but when i type /book/edit/9/ Then it says no URL macthed in config file

I am using Django generic View but when i type

/book/edit/9/

Then it says no URL macthed in config file

My URL file is

from django.conf.urls.defaults import *
from django.conf.urls.defaults import *
from myapp.views import *
from django.contrib import admin
from django.conf import setti开发者_StackOverflowngs
from django.views.generic.simple import direct_to_template
from django.views.generic import list_detail
from myapp.models import *
from django.views.generic import create_update
from django.views.generic.create_update import update_object


book_info = {'model' : Book}

(r'^book/create/$', create_update.create_object, book_info),
(r'^book/edit/(?P<object_id>d+)/$',create_update.update_object,book_info),

The create part is working fine


You're missing the escape on the d (\d): you want (r'^book/edit/(?P<object_id>\d+)/$',create_update.update_object,book_info)


Correct on the backslash need. This bit me too. I suspect this is hurting a lot of newbies. This is a high priority for fixing.

0

精彩评论

暂无评论...
验证码 换一张
取 消