[Django1.5]'url' requires a non-empty first argument. 错误


在django1.4 中这么引用url是没错的

<h3><a href="{% url detailblog blog.id %}"> {{ blog.caption }}</a></h3>

但是在1.5中就会有如下错误

'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.


解决方法是"{% url detailblog blog.id %}"

变为"{% url “detailblog” blog.id %}"

加上一个双引号或者单引号 


Prior to Django 1.3, syntax like {% url myview %} was interpreted incorrectly (Django considered "myview" to be a literal name of a view, not a template variable named myview).

你可能感兴趣的:(python,django,url,1,5)