1

I am working on a django-nonrel app in Google App Engine.

I am trying to return items from a database in a random order. So I might have 100 items in my Items model. I wish to return a random selection of 20 items.

I have tried using:

Items.objects.order_by('?')[:20]

Except I get the following error:

Randomized ordering isn't supported by the backend

I take it this is a limitation of django-nonrel on GAE?

Is there an alternative method I could use for django-nonrel on GAE to get the same effect?

4

1 回答 1

2

我已经设法为此找到解决方法。

我只是使用 python 的 random.shuffle(LIST_ITEM) 作为这样做的一种方式。

最后其实很简单。

于 2010-10-26T10:47:54.947 回答