This will work:
>>> for id in Review.objects.values_list('id',flat=True):
... print('ID:%d' % id)
...
ID:1
ID:2
ID:3
ID:4
ID:5
ID:6
and i don't know what you say in ur problem2
wblueboat
From: karlnaflnest
Date: 2018-01-03 15:20
To: Django users
Subject: I can't print a queryset va
My other problem is when using a queryset value in my method:
This works:
insert_to_db(id)
But this does not:
insert_to_db(id, result)
Any help would be greatly appreciated :)
What is the insert_to_db function? That's probably where your issue is.
Without that code, there probably isn't
I am trying to pass a queryset value as an argument to a method but it
won't proceed; it shows no error. And I tried printing it like this:
for id in Review.objects.values_list('id', flat=True):
print("ID: " + id)
Output:
1
However, it worked and looped when I changed it to this:
for id in
3 matches
Mail list logo