开发者

URLs not working

My URLs for my application looks like this:

(r'^admin/', include(admin.site.urls)),
 (r'^contractManagement/login', 'django.contrib.auth.views.login', {'template_name': 'login.html'},()),
 (r'^contractManagement/logout', 'contractManagement.contracts.views.logout_view'),
 (r'^contractManagement/', 'contractManagement.contracts.views.index'),
 (r'^accounts/profile/(?P<contract>[^/]+)/edit$', 'contractManagement.contracts.views.editContract'), 
 (r'^accounts/profile/(?P<contract>[^/]+)/$', 'contractManagement.contracts.views.viewContract'),
 (r'^accounts/profile/$', 'contractManagement.contracts.views.loggedIn'),
 (r'^accounts/profile/newContract$', 'contractManagement.contracts.views.add开发者_开发技巧Contract'),
 (r'^accounts/profile/newClient$', 'contractManagement.contracts.views.addClient'),            
 (r'^accounts/profile/logout$', 'django.contrib.auth.views.logout', {'template_name': 'LoggedOut.html'},()), 

I am now getting an error No Contract matches the given query. This is a 404 error. I don't know why the views for /accounts/profile/newContract/ don't require a contract. If you need anything else leave a comment.


Django URL patterns are processed in order. It looks like your /accounts/profile/newContracts/ URL is matching your r'^accounts/profile/(?P<contract>[^/]+)/$' pattern.

Try moving your r'^accounts/profile/newContract$' pattern higher up. (and fix the missing 's' typo)

But more importantly, make sure you have a URL scheme that's not ambiguous.


(r'^accounts/profile/newContract$' newContract - Without s. And you go to the /accounts/profile/newContracts . With s at end And if you to newContracts it will matcht this url : (r'^accounts/profile/(?P[^/]+)/$', 'contractManagement.contracts.views.viewContract'), And will look for newContracts

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜