I am storing tags as a string seprated by commas in a model and i am trying to print those in template but it is not working I tried Django templates - split string to array answer but it is also not working nothing is printed and the function tags_as_list is also not running
model
class News(models.Model):
link = models.TextField()
headline = models.TextField()
summary = models.TextField()
tags = models.TextField(blank=True)
time_date = models.DateTimeField(auto_now_add=True)
def tags_as_list(self):
print("tagsss")
return self.tags.split(',')
template
{% for tag in news_item.tags.tags_as_list %}
{{ tag }}
{% endfor %}