Форум сайта python.su
Здравствуйте!
Перешел на релиз 1.5
Ошибка ‘url’ requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.
в строке <a href=“{% url auto.views.viewpost post.slug %}”><h3>{{post.title}}</h3></a>
В доке написано следующее:
One deprecated feature worth noting is the shift to “new-style” url tag. 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). Django 1.3 and above introduced the {% load url from future %} syntax to bring in the corrected behavior where myview was seen as a variable.
The upshot of this is that if you are not using {% load url from future %} in your templates, you’ll need to change tags like {% url myview %} to {% url “myview” %}. If you were using {% load url from future %} you can simply remove that line under Django 1.5
Хотя слова все знакомы, общий смысл мне непонятен. Что за url из будущего? Причем здесь версия 1.3 (я сам начал изучение с 1.4)? И главное, что делать-то? Взятие в кавычки auto.views.viewpost post.slug приводит к ошибке
NoReverseMatch
Reverse for ‘auto.views.view_post post.slug’ with arguments ‘()’ and keyword arguments ‘{}’ not found.
Спасибо!
Отредактировано dnstuff (Фев. 14, 2013 14:42:34)
Офлайн
dnstuff
you’ll need to change tags like {% url myview %} to {% url “myview” %}
Отредактировано inoks (Фев. 14, 2013 16:02:15)
Офлайн
inoksВы поставили 3 кавычки. Опечатка наверное.
Отредактировано dnstuff (Фев. 15, 2013 10:08:31)
Офлайн
Где три кавычки? Все ок, если как вам написали на SO, c переменной post.slug все ок - то должно работать.
Офлайн