Hi, I'd like to have a sliced query set in random order.
I tried coupon_items = Item.objects.order_by('?')[:25] ,it seemed to work first but than I noticed that coupon_items consists of doubled items (although all Item objects are distinct). coupon_items = Item.objects.all()[:25].order_by('?') doesn't work because you can't reorder a queryset once a slice has been taken. coupon_items = Item.objects.all()[:25] random.shuffle(coupon_items) doesn't word because a QuerySet object does not support item assignment, which is used by random.shuffle. The problem was also adressed by this thread http://groups.google.com/group/django-users/browse_thread/thread/1364d04127caff99 but I didn't get the answer... Regards, Benjamin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---