Adding an object attribute value to an array Django
<p>I am new to Django and this is my first project using it. I have run into an issue I don't understand and (perhaps I'm not using the right search terms) I'm not finding any relevant results in searching for solutions.</p>

<p>I was trying to get an array of distinct entries in the 'topic' field of my model. I was playing about in the shell, trying to figure this out when I got the following result which I didn't expect.</p>

<p>This is what I entered in the shell:</p>

<pre><code>&gt;&gt;&gt; from pomodoro.models import Chunk, Result
&gt;&gt;&gt; Chunk.objects.all()
&lt;QuerySet [&lt;Chunk: Onboard State Estimation&gt;, &lt;Chunk: Newton's 2nd Law of Motion&gt;, &lt;Chunk: IF&gt;]&gt;
&gt;&gt;&gt; a = []
&gt;&gt;&gt; for q in Chunk.objects.all(): a += q.topic
...
&gt;&gt;&gt; a
['R', 'o', 'b', 'o', 't', 'i', 'c', 's', 'M', 'e', 'c', 'h', 'a', 'n', 'i', 'c', 's', 'L', 'o', 'g', 'i', 'c']
&gt;&gt;&gt; ose = Chunk.objects.get(pk=1)
&gt;&gt;&gt; ose.topic
'Robotics'
</code></pre>

<p>I don't understand why I ended up with an array of individual letters rather than an array of the 'topic' strings. Can someone explain why this happened?</p>

<p>I'm also aware that there are much better ways of doing what I'm trying to do but, as a beginner, I haven't got to grips with Django properly.</p>