Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django remaining elements truncated

Tags:

list

django

I am new to django, I want to get the id that has the name field contains "John". Below snippet code runs very well but,

In view.py

 all_ids=Employee.objects.filter(name__contains = 'John').values('id')
    return HttpResponse(" All id= %d " %all_ids)

It returns :

  All id=[{'id': 1},{'id':2} , so on  '...(remaining elements truncated)...'] 

There is a limitation to display 20 the items. So, How can I get rid of this limitations and (remaining elements truncated) ? Is there a better way to get a field's all values in a query without truncated ?

like image 793
John Smith Avatar asked Sep 26 '12 20:09

John Smith


1 Answers

one way to do override it would be

all_ids= list(Employee.objects.filter(name__contains = 'John').values('id'))
like image 52
karthikr Avatar answered Sep 21 '22 08:09

karthikr