Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Could not parse the remainder: ':' from '1:'

TemplateSyntaxError at /challeges/1

Could not parse the remainder: ‘:’ from ‘1:’

This is my challege.html

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

{% if month == 1: %}
<h1>This is {{ text }}</h1>
{% else: %}
<p>This is {{ text }}</p>
{% endif %}

This is my views.py

def monthly_challege(request, month):
    return render(request, "challeges/challege.html", {
        "text": "Your Url Is Empty",
        month: month
})

This is my urls.py

urlpatterns = [
    path("<month>", views.monthly_challege),
]

>Solution :

You have a typo in your if … else … statement.
It should be

{% if month == 1 %}
    <h1>This is {{ text }}</h1>
{% else %}
    <p>This is {{ text }}</p>
{% endif %}

as per doc if else doc

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading