TemplateSyntaxError

12 views
Skip to first unread message

anchal agarwal

unread,
May 31, 2019, 10:12:24 AM5/31/19
to django...@googlegroups.com
I am creating a simple form in which when a user will select a particular song and press Favorite button a star image will get pop up in front of that song. 
But it is showing TemplateSyntaxError. 
Please correct me where I am wrong
here is my template

<img src="{{ album.album_logo.url }}">

<h1>{{ album.album_title}}</h1>
<h3>{{ album.artist }}</h3>

{% if error_message %}
<p><strong>{{ error_message }}</strong></p>
{% endif %}

<form action="{% url 'music:favorite' albums_id %}" method="post">
{% csrf_token %}
{% for song in album.song_set.all %}
<input type="radio" id="song{{ forloop.counter }}" name="song" value="{{song.id}}">
<label for="song{{ forloop.counter }}">
{{ song.song_title }}
{{% if song.is_favorite %}}
{{% endif %}}
</label><br>
<input type="submit" value="Favorite" >
</form>

sagar ninave

unread,
Jun 1, 2019, 1:56:12 AM6/1/19
to django...@googlegroups.com
you do not have ended for loop

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMT%3DisUed7dkD%2BPCgis7bBZSAveti1Wy4WgNSoPA7Dm6kKLO3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--

anchal agarwal

unread,
Jun 3, 2019, 2:23:11 AM6/3/19
to django...@googlegroups.com

You were right....the error resolved when I removed curly braces from the if statement. Thanks alot !!

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.


--

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages