Good idea, thank you! :-D
On May 8, 6:10 pm, Tim Chase wrote:
> > First define some list contain random values such as:
>
> foo_list = (3, 4, 5, 2)
>
> > Then use QuerySet to query the list in a table, but it returns objects
> > will increase id value.
>
> foo = Foo.objects.filter(id__
> First define some list contain random values such as:
>
foo_list = (3, 4, 5, 2)
>
> Then use QuerySet to query the list in a table, but it returns objects
> will increase id value.
>
foo = Foo.objects.filter(id__in = foo_list)
>
> Actually result:
print foo.values
> [{'id': 2}
First define some list contain random values such as:
>>> foo_list = (3, 4, 5, 2)
Then use QuerySet to query the list in a table, but it returns objects
will increase id value.
>>> foo = Foo.objects.filter(id__in = foo_list)
Actually result:
>>> print foo.values
[{'id': 2}, {'id': 3}, {'id': 4
3 matches
Mail list logo