pyjade icon indicating copy to clipboard operation
pyjade copied to clipboard

a(href=url index) ?

Open gummz opened this issue 10 years ago • 5 comments

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?

gummz avatar Aug 25 '15 21:08 gummz

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.

blx avatar Aug 28 '15 02:08 blx

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.

eskhool avatar Sep 11 '15 13:09 eskhool

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'")

?

blx avatar Sep 11 '15 20:09 blx

Ideally a(href=url("index")) just because it looks right and fits with jade

eskhool avatar Sep 14 '15 11:09 eskhool

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' %}')

zhaolixiao avatar Sep 23 '16 07:09 zhaolixiao