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 value.
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 Review.objects.values_list('id', flat=True):    print(id)
Output:
1
2
3
4
5


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 :)
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8003bf92-c580-4d10-9e42-d4fade579bd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5a4cacd7.8a61650a.e2f79.0bb6SMTPIN_ADDED_BROKEN%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to