Created
October 9, 2012 01:03
-
-
Save ciceroverneck/3855943 to your computer and use it in GitHub Desktop.
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Guardo o valor do
randint(0,99999)
zé..