how to add python code in href attribute in html tag [closed]
I am new to python, I have a code that iterates the list in HTML using python
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{% e.url %}"> url </a>
{% endfor %}
getting template syntax error in href tag. Please let me know if you know the solution.
python html django
closed as unclear what you're asking by DYZ, Klaus D., cнŝdk, Daniel Roseman, Andrei Suvorkov Nov 26 '18 at 8:28
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I am new to python, I have a code that iterates the list in HTML using python
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{% e.url %}"> url </a>
{% endfor %}
getting template syntax error in href tag. Please let me know if you know the solution.
python html django
closed as unclear what you're asking by DYZ, Klaus D., cнŝdk, Daniel Roseman, Andrei Suvorkov Nov 26 '18 at 8:28
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
3
What kind of template is this? Django?
– DYZ
Nov 26 '18 at 7:26
add a comment |
I am new to python, I have a code that iterates the list in HTML using python
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{% e.url %}"> url </a>
{% endfor %}
getting template syntax error in href tag. Please let me know if you know the solution.
python html django
I am new to python, I have a code that iterates the list in HTML using python
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{% e.url %}"> url </a>
{% endfor %}
getting template syntax error in href tag. Please let me know if you know the solution.
python html django
python html django
edited Nov 26 '18 at 7:31
user1553680
asked Nov 26 '18 at 7:24
user1553680user1553680
6417
6417
closed as unclear what you're asking by DYZ, Klaus D., cнŝdk, Daniel Roseman, Andrei Suvorkov Nov 26 '18 at 8:28
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by DYZ, Klaus D., cнŝdk, Daniel Roseman, Andrei Suvorkov Nov 26 '18 at 8:28
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
3
What kind of template is this? Django?
– DYZ
Nov 26 '18 at 7:26
add a comment |
3
What kind of template is this? Django?
– DYZ
Nov 26 '18 at 7:26
3
3
What kind of template is this? Django?
– DYZ
Nov 26 '18 at 7:26
What kind of template is this? Django?
– DYZ
Nov 26 '18 at 7:26
add a comment |
2 Answers
2
active
oldest
votes
Change the url tag to
href="{{ e.url }}"
The "{% ... %}"
is used for python statement instead of expression, which we shall use "{{ ... }}"
.
it will work
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{{ e.url }}"> url </a>
{% endfor %}
it worked ... thanks
– user1553680
Nov 26 '18 at 9:07
add a comment |
You are using Django template url, which should be like,
{% url 'name' *args if you have %}
As there is no other data in your question, so i recommend reading Django Official Docs and add accordingly.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Change the url tag to
href="{{ e.url }}"
The "{% ... %}"
is used for python statement instead of expression, which we shall use "{{ ... }}"
.
it will work
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{{ e.url }}"> url </a>
{% endfor %}
it worked ... thanks
– user1553680
Nov 26 '18 at 9:07
add a comment |
Change the url tag to
href="{{ e.url }}"
The "{% ... %}"
is used for python statement instead of expression, which we shall use "{{ ... }}"
.
it will work
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{{ e.url }}"> url </a>
{% endfor %}
it worked ... thanks
– user1553680
Nov 26 '18 at 9:07
add a comment |
Change the url tag to
href="{{ e.url }}"
The "{% ... %}"
is used for python statement instead of expression, which we shall use "{{ ... }}"
.
it will work
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{{ e.url }}"> url </a>
{% endfor %}
Change the url tag to
href="{{ e.url }}"
The "{% ... %}"
is used for python statement instead of expression, which we shall use "{{ ... }}"
.
it will work
{% for e in news %}
<h5 class="title"> {{ e.title }}</h5>
<a href="{{ e.url }}"> url </a>
{% endfor %}
edited Nov 26 '18 at 11:33
Kevin Winata
424
424
answered Nov 26 '18 at 7:36
Shihabudheen K MShihabudheen K M
499312
499312
it worked ... thanks
– user1553680
Nov 26 '18 at 9:07
add a comment |
it worked ... thanks
– user1553680
Nov 26 '18 at 9:07
it worked ... thanks
– user1553680
Nov 26 '18 at 9:07
it worked ... thanks
– user1553680
Nov 26 '18 at 9:07
add a comment |
You are using Django template url, which should be like,
{% url 'name' *args if you have %}
As there is no other data in your question, so i recommend reading Django Official Docs and add accordingly.
add a comment |
You are using Django template url, which should be like,
{% url 'name' *args if you have %}
As there is no other data in your question, so i recommend reading Django Official Docs and add accordingly.
add a comment |
You are using Django template url, which should be like,
{% url 'name' *args if you have %}
As there is no other data in your question, so i recommend reading Django Official Docs and add accordingly.
You are using Django template url, which should be like,
{% url 'name' *args if you have %}
As there is no other data in your question, so i recommend reading Django Official Docs and add accordingly.
answered Nov 26 '18 at 7:50
Bidhan MajhiBidhan Majhi
7141416
7141416
add a comment |
add a comment |
3
What kind of template is this? Django?
– DYZ
Nov 26 '18 at 7:26