how to add python code in href attribute in html tag [closed]












0















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.










share|improve this 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
















0















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.










share|improve this 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














0












0








0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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














  • 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












2 Answers
2






active

oldest

votes


















2














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





share|improve this answer


























  • it worked ... thanks

    – user1553680
    Nov 26 '18 at 9:07



















0














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.






share|improve this answer






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














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





    share|improve this answer


























    • it worked ... thanks

      – user1553680
      Nov 26 '18 at 9:07
















    2














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





    share|improve this answer


























    • it worked ... thanks

      – user1553680
      Nov 26 '18 at 9:07














    2












    2








    2







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





    share|improve this answer















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






    share|improve this answer














    share|improve this answer



    share|improve this answer








    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



















    • 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













    0














    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.






    share|improve this answer




























      0














      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.






      share|improve this answer


























        0












        0








        0







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 '18 at 7:50









        Bidhan MajhiBidhan Majhi

        7141416




        7141416















            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen