i want to compare num and {{buildSummary_list.number}}, but why it is not work? And i got an error
Could not parse the remainder: '{{buildSummary_list.number}}' from '{{buildSummary_list.number}}'"...
{% for num in buildSummary_list.paginator.page_range %}
{% ifequal num {{buildSummary_list.number}} %}
<b>{{num}}</b>
{% endifequal %}
{% ifnotequal num {{buildSummary_list.number}} %}
<a href="?page={{num}}"><b>{{num}}</b></a>
{% endifnotequal %}
{% endfor %}
I want to make the pagination have effect: pre << 1 2 3 4 5 6 >> next
I my code can run, can it make this effect? thanks:D
This error usually means you've forgotten a closing quote somewhere in the template you're trying to render. For example: {% url 'my_view %} (wrong) instead of {% url 'my_view' %} (correct). In this case it's the colon that's causing the problem. Normally you'd edit the template to use the correct {% url %} syntax.
But if you look at it carefully, you will think the error message is very helpful and clear TemplateSyntaxError: Could Not Parse The Remainder. The error is because of the Django static tag's argument 'css/dept_emp_style. css', the single quote( ' ) is not an English character. Instead, it is a Chinese character.
A Django template is a text document or a Python string marked-up using the Django template language. Some constructs are recognized and interpreted by the template engine. The main ones are variables and tags. A template is rendered with a context.
Inside a {% %}
tag, variables aren't surrounded by {{
. Try this:
{% ifequal num buildSummary_list.number %}
Also, it looks like your two comparisons can be joined with an else:
{% for num in buildSummary_list.paginator.page_range %}
{% ifequal num buildSummary_list.number %}
<b>{{num}}</b>
{% else %}
<a href="?page={{num}}"><b>{{num}}</b></a>
{% endifequal %}
{% endfor %}
I got this error when I forgot the '' around the path to a static file
This gave the error:
<link rel='stylesheet' href="{% static css/style.css %}">
This fixed the error:
<link rel='stylesheet' href="{% static 'css/style.css' %}">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With