我试图通过网址传递电子邮件,但我收到此错误:
当前网址fback / test@gmail.com/与这些网址中的任何一个都不匹配。
我的urls.py
是:
from django.conf.urls import *
urlpatterns = patterns('fback.views',
url(r'^$', 'index', name='index'),
url(r'^fback/(?P<email>\t+)/$', 'vedi_dettagli', name='vedi'),
#url(r'^fback/dettagli', 'vedi_dettagli', name='vedialtro'),
)
views.py
是:
def vedi_dettagli(request, email):
vedi = get_object_or_404(Societa, email='email')
response = render_to_response('fback/dettagli.html', RequestContext(request, locals()))
return response
任何人都可以看到错误吗?
答案 0 :(得分:0)
尝试
url(r'^fback/(?P<email>\w+)/$', 'vedi_dettagli', name='vedi'),
也:
def vedi_dettagli(request, email):
vedi = get_object_or_404(Societa, email=email) ####<< not 'email'
response = render_to_response('fback/dettagli.html', RequestContext(request, locals()))
return response