So Everything works fine with my initial 5 urls in the urls.py
file.
urlpatterns = patterns('',
url(r'^add/$', PostCreateView.as_view(), name='create'),
url(r'^$', PostListView.as_view(), name='list'),
url(r'^(?P<pk>[\w\d]+)/$', PostDetailView.as_view(), name='detail'),
url(r'^(?P<pk>[\w\d]+)/edit/$', PostUpdateView.as_view(), name='update'),
url(r'^(?P<pk>[\w\d]+)/delete/$', PostDeleteView.as_view(), name='delete'),
)
But when I add an extra line. Let's say
url(r'^test/$', test.as_view(), name='test'),
I am hit with a 500 Server error page and with debugging it is stating that there is a validation error?
"test is not a valid objectid"
i feel it's an issue with mongoengine but do not what or where.
The order of the rules matter. This rule will match test/
:
url(r'^(?P<pk>[\w\d]+)/$', PostDetailView.as_view(), name='detail'),
Define your rules like this:
urlpatterns = patterns('',
url(r'^add/$', PostCreateView.as_view(), name='create'),
url(r'^$', PostListView.as_view(), name='list'),
url(r'^test/$', test.as_view(), name='test'),
url(r'^(?P<pk>[\w\d]+)/$', PostDetailView.as_view(), name='detail'),
url(r'^(?P<pk>[\w\d]+)/edit/$', PostUpdateView.as_view(), name='update'),
url(r'^(?P<pk>[\w\d]+)/delete/$', PostDeleteView.as_view(), name='delete'),
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.