Django签署者价值 [英] Django signer value
问题描述
我正在尝试对django模型pk进行加密,以使用django签名者通过模板中的url将其发送:
Im trying to encrypt a django model pk to send it via url from a template using django signer :
signer = Signer()
value = signer.sign(pk)
url = {% myapp:url value %}
但是我在网址中输入了pk和签名,例如以下示例(pk = 110):
But i get in my url the pk plus the signature, like this example (pk=110) :
'110:EkfQJafvGyiofrdGnuthdxImIJw'
我想要的是只检索没有pk(110或我发送的任何值)的签名.
What i want it's only to retrieve the signature without the pk (110 or any value i send).
任何想法,或者不使用模型中的anothe字段,如何以其他方式加密pk?
Any idea how ?, or any other way to encrypt the pk without using anothe field in the model ??
预先感谢
推荐答案
首先使用django过滤器尝试pk签名,并阅读url文档以将pk和签名传递给视图
Try first with a django filter for pk's signature and read the urls documentation for passing the pk and signature to the view
https://docs.djangoproject.com/en/1.11/topics/http/urls/#include-other-urlconfs
这篇关于Django签署者价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!