In my Django application, using Postgresql, I have a model with an ArrayField of CharFields. I would like to know if there's a DB way to aggregate and get a list of all the strings in the table. For example:
- ['dog', 'cat']
- ['dog']
- ['cat']
would yield ['dog', 'cat']
I know how to do that in Python but would like to find out a way to aggregate this on the DB level. Using Django 1.8.4
In PostgreSQL you can do the following:
So if your model looks something like
the Django equivalent is: