I have queryset like this:
hello = Hello.objects.all()
In template I would do like this to get the data:
{% for h in hello %}
{% for i in h.data %} #data is stored like this ['a', 'b', 'c'] --> I want to access individual componenet, thus I would do:
{{i}}
{% endfor %}
{% endfor %}
But instead of yielding data as:
a
b
c
It yields as ['a', 'b', 'c']
What's wrong? I have a reason to store data in list. How to access each data seperately. Thanks
Purpose:
Colors are stored in data field as: [black, green, brown]
Thus I want to achieve:
div style="color: black"
div style="color: green"
div style="color: brown"
Edit
models.py
class Hello(models.Model):
user = models.ForeignKey(User)
data = models.CharField(max_length=255)
def __str__(self):
return "%s's decoration photos" % self.user