Sunday, June 2, 2019

Re: TemplateSyntaxError

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

On 01-Jun-2019 11:26 am, "sagar ninave" <sagarninave@gmail.com> wrote:
you do not have ended for loop

On Fri, May 31, 2019 at 7:41 PM anchal agarwal <agarwalanchal72@gmail.com> wrote:
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>

--
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-users@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.


--

--
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-users@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/CAA6pdZ-yw6hsS7aOj4czvEY5uCeb5NdYOuUiY50SvGvhyPA5_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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-users@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%3DisXQdR2fvYbE-vGhOZVMrnqWvpXR5Rb%3D3XXF6a5Fi8RiqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment