Open gummz opened 9 years ago
Yup, just like that should work!
I'm using pyjade with django and have lots of elements using django tags:
link(rel="stylesheet", href="{% static 'x.css' %}")
form(action="{% url 'buy:pay' %}")
etc.
I believe the OP wanted to not have to use the {% delimiters that django template engine and use the jade syntax instead. Your examples don't answer that, I think.
Good point. But I don't believe there's a direct translation.
- load crispy_forms
works because it's a line statement in pyjade, but without some kind of delimiter pyjade can't parse it (at present) when it's mixed into a tag's attributes or so on.
What would be the expected/desired/intuitive jade syntax for this?
a(href=url("index"))
a(href="- url 'index'")
?
Ideally a(href=url("index")) just because it looks right and fits with jade
I tried a lot times, finally figure it out:
html code:
<a href="{% url 'polls:detail' question.id %}">{{ question.question_text }}</a>
then Jade code should be:
a(href!='{% url 'polls:detail' question.id %}')= question.question_text
and if the 'detail' link don't need paramater, it should be like this:
a(href!='{% url 'polls:detail' %}')
The reason why I love PyJade so much is that I can for example do - load crispy_forms instead of {% load crispy_forms %}. But how would I do this for
a(href="{% url 'index' %") ? Can I do that?