Reputation: 55
When developing a website i run over a question. I have a query object and i want to iterate through all its` properties like
for i in object:
print(i)
Haven`t found anything on Web. Any ideas?
Upvotes: 0
Views: 659
Reputation: 1605
A query object contains a lot more properties other than the model fields. You can use the .values
.
Here is how to use this: How do I convert a Django QuerySet into list of dicts?
Upvotes: 1