Django: access manytomany field in template -


models.py

class song(models.model):     tags = models.manytomanyfield('tag', related_name='songs', blank=true)  class tag(models.model):     name = models.charfield(max_length=10) 

template.html

{% tag in song.tags.all %}    <i>{{ tag.name }}</i> {% endfor %} 

it turns out there nothing in tag area, namely, rendered html nothing. me?


Comments

Popular posts from this blog

php - Extract Text from HTTP referer -

Receive udp packets in android gstreamer -

authentication - ASP.NET Core 1.0. Bearer Token, cannot access custom claims -