So I have a model something like this
class Record(models.Model):
name = models.CharField()
synonyms = ArrayField(models.CharField())
and I do have the following records:
Record 1 = Record(name=rec1, synonyms=['a','b'])
Record 2 = Record(name=rec2, synonyms=['c'])
Record 3 = Record(name=rec3, synonyms=['d','e'])
I want to get only synonyms for all records in a list.
I've tried:
synonyms_list = Record.objects.all().values_list('synonyms')
And it return:
[['a','b'],['c'],['d','e']]
But i want it to unpack the synonym list and I want the result to be something like this
['a','b','c','d','e']
Is it possible to do it using Django ORM or using postgres query ?