ho iniziato ad usare Django Versione 1.5 e ha un problema con il mio vecchio codice:Django release 1.5: 'url' richiede un primo argomento non vuoto. La sintassi cambiato in Django 1.5
<a href="{% url auto.views.viewpost post.slug %}"><h3>{{post.title}}</h3></a>
Errore: 'url' richiede un primo argomento non vuoto. La sintassi è cambiata in Django 1.5, vedi i documenti. Documenti:
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
Poi ho provato: <a href=“{% url ‘auto.views.view_post’ post.slug %}”><h3>{{post.title}}</h3></a>
ma ottenuto l'errore d'inversione per ‘auto.views.view_post’ con argomenti ‘(’ ')' e gli argomenti delle parole chiave ‘{}’ non trovato. :( Che cosa sto facendo di sbagliato? Thx!
è '' auto' sul PYTHONPATH' di Django? Forse hai bisogno di qualcosa come ''somedir.auto.views.view_post'' lì? E una domanda più ovvia è "auto.views.view_post" menzionata nel tuo URLconf? –