Merging or joining raw query set results.

16 views
Skip to first unread message

ML

unread,
Sep 14, 2019, 9:47:02 AM9/14/19
to Django users
Hi,

I have a raw query which takes in 4 ids within a for loop. It therefore returns 4 query set results.

I put the result of each query set into a dictionary and append it to a list.
The result looks something like this:

[{'first_name': u'John'}, {'first_name': u'Jack'}, {'first_name': u'Jill'}]
[ ]
[{'first_name': u'James'}, {'first_name': u'Phil'}]
[{'first_name': u'Bill'}]

I'm trying to merge the query set results into one list to get something like
[{'first_name': u'John'}, {'first_name': u'Jack'}, {'first_name': u'Jill'}, {'first_name': u'James'}, {'first_name': u'Phil'}, {'first_name': u'Bill'}]

Any help will be appreciated. 
Reply all
Reply to author
Forward
0 new messages