Created
October 9, 2012 01:03
Order + RAND() django ORM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
from app.models import MyModel | |
MyModel.objects.raw('SELECT * FROM `app_mymodel` ORDER BY RAND(%d)' | |
% randint(0,99999)) |
Guardo o valor do randint(0,99999)
zé..
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
seed randomico só pra explicar ne?!
desse jeito é melhor deixar so o rand() po rs