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

authentication - Mongodb revoke acccess to connect test database -

python - GitPython: check if git is available -

c - getting error: cannot take the address of an rvalue of type 'int' -