Reputation: 103
How to retrieve the data from Django queryset for use in a variable
When an output is received in below form after running the query
<QuerySet [{'name': 'John'}]>
I want to use the value 'John' in a variable for further processing.
How do I extract this ?
Upvotes: 5
Views: 13046
Reputation: 546
k = <QuerySet [{'name': 'John'}]>
k[0] = {'name': 'John'}
Queryset is a list.
Upvotes: 3