Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67411

How to fix the html code in django template

$
0
0

The template has an issue. That is tag in my base.html shows that there is no closing tag and in list.html file the warnings are about {% already exists(expected endif instead of endfor)

Python 3.8.0rc1,pip 19.3.1,and the django version is 2.2.6

    list.html 
    <ul>
        <li {% if not category %}class="selected"{% endif %}>
            <a href="{% url "shop:product_list"%}">All</a>
        </li>
    {% for c in categories %}
        <li {% if category.slug == c.slug %}class="selected"{% endif %}>
            <a href="{{ c.get_absolute_url }}">{{ c.name }}</a>
        </li>
    {% endfor %}
    </ul>

    base.html
   <head>
   <meta charset="utf-8" />
   <title>{% block title %}My shop{% endblock %}</title>
   <link href="{% static" css/base.css" %}"  rel="stylesheet">
   </head>

The attribute name is missing(points at c.slug). I'm an amateur,I've just started working with django,please do help,Thanks in adavance.


Viewing all articles
Browse latest Browse all 67411

Trending Articles