title: How to regroup entries in Django by model field?
body: <p>First i'm not an exeperienced developer in Django, i use Django 4.0.6 on windows 10 and python 3.8.9 in a virtual environment.</p>
  <p>I need help with my query in Django:</p>
  <p>first here's my model:</p>
  <pre><code>from django.db import models
  
  class MyWords(models.Model):
      WordText=models.CharField(max_length=1000, unique=True)
      WordStatus=models.IntegerField()
      WordType=models.CharField(max_length=30)
  </code></pre>
  <p>and i have this sqllite database table with the following entries as example:
  <br/>db.sqlite3
  <br/>MyWords Table:</p>
  <pre><code>WordText  WordStatus  WordType
  Dog       0           Animal
  Cat       1           Animal
  Car       4           Object
  Lion      1           Animal
  Computer  4           Inanimate Object
  Stone     5           Inanimate Object
  Child     4           Human
  </code></pre>
  <p>What i want to do is to get this info back this way:</p>
  <pre><code>data == [
  {'WordType':'Object', 'WordStatus':4,'WordText':'Car'},
  {'WordType':'Animal', 'WordStatus':[0,1,1], 'WordText':'Dog','Cat','Lion'},
  {'WordType':'Inanimate Object', 'WordStatus':[4,5], 'WordText':'Computer','Stone'},
  {'WordType':'Human', 'WordStatus':4, 'WordText':'Human'}
  ]
  </code></pre>
  <p>Essentially i want to regroup/categorize the entries by WordType so i can access them more easily.</p>
  <p>Is this possible in Django ORM? If yes, how?</p>
  <p>I first thought using something like a values_list with WordType as argument followed by a distinct and annotate, but i'm stucked.
  Something like this:</p>
  <pre><code>data =MyWords.objects.all().values_list('WordType').distinct().annotate(WordStatus=?).annotate(WordText=?)
  </code></pre>
  <p>I don't know if it's correct because i don't know what to replace the question marks with. I don't know if i'm on the correct path. So can anyone guide me please?</p>
  <p>N.B: I don't want to use raw Sql queries if possible, because the rest of the project only uses Django ORM, that's why i'm asking, else i would use simply raw Sql queries to do the work.</p>