我记得前一段时间遇到过这样的问题,但在互联网上找不到链接,所以第二次可能会问这个问题。令人非常犹豫的是,Django将int值转换为unicode,必须在每次场合将值转换为整数。是否有任何原生语法可以阻止Django执行此操作?
url(r'some_url/(?P<some_param>\d+)/$', some_view, name = 'some_url')
def some_view(request, some_param):
a = int(some_param) # Having to write this surplus int is very very irritating
JS
$.get('/some_url/6545/', function(response){...