Reputation: 109
I looked through my code a few times and at all previous answers to this error and could still not find a solution.
Below is the code in question:
base.html:
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge">
<meta name="viewport" content="wideth=device-width, initial-scale=1">
<title>{% block title %}Rapid Prototypes {% endblock %}</title>
<link rel="stylesheet" href="{% static 'css/site.css' %}">
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
</head>
<body id="{% block body-id %}body{% endblock %}">
{% block top-nav-wrapper %}
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle"
data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Rapid Prototypes</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li {% if slug=='index' %}class="active"{% endif %}>
<a href="/">Home</a>
</li>
<li {% if slug=='contact' %}class="active"{% endif %}>
<a href="{% url 'page' 'contact' %}">Contact</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li {% if slug=='login' %}class="active"{% endif %}>
<a href="{% url 'page' 'login' %}">Login</a>
</li>
</ul>
</div>
</div>
</div>
{% endblock %}
{% block content %}{% endblock %}
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
</body>
</html>
The error is said to be on the 29th line which is the line with the first if statement. The exact error statement is: Could not parse the remainder: '=='index'' from 'slug=='index''
Thank you in advance for your help!
Upvotes: 1
Views: 15649
Reputation: 1733
From the documentation, you need spaces around boolean operators
Upvotes: 7