Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
631 views
in Technique[技术] by (71.8m points)

django url 传入参数带有空格怎么处理?

请问,我在django里,传递到url的参数带有空格,因为url写的是根据产品的title来判断页面。
譬如说一个产品title叫做 small green bike 传递参数进去 www.xx.com/samll green bike.
虽然页面打得开页面,但是url不合法。想要加上横岗- 譬如说small-green-bike,这样url合法了。可是前端页面渲染出来又有横岗。
请问要怎么在url里带有横岗,然后再前端页面渲染出来又没有横岗呢?
想说在model层再建立一个字段,可是感觉这样好像很不科学,又多此一举,应该有更好的方法吧?
自学django中,好多不明白。
谢谢。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

对URL中特殊字符,如空格,转义?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...