我正在向用户发送电子邮件。我有一个工作链接让用户将布尔设置为“真”。虽然,我无法获得正确的 URL 将其设置为 False。在views.py中:
def confirm(request, itemnum):
item = get_object_or_404(PurchaseOrder, item_number = itemnum)
item.confirmed = True
item.save()
return HttpResponse('Item number %s changed to true' % itemnum )
def deny(request, itemnum):
item = get_object_or_404 (PurchaseOrder, item_number = itemnum)
item.confirmed = False
item.save()
return HttpResponse('Item number %s changed to false' %itemnum)
在 urls.py 中:
urlpatterns = patterns('',
url(r'^(?P<itemnum>\d+)/$', views.confirm, name = 'confirm-page'), #This it to set the bool as true. I just need a url to set it as false that uses a itemnum, but somehow adds a keyword maybe such as false/56/
)
我需要设置一个 URL,让用户使用每个项目的唯一主键将其更改为 false。但我该怎么做呢?