mardi 3 février 2015

python django randomly select value excluding one

I have a view like:



try:
check_winner = Winner.objects.get(phone_no=9899889988)
if check_winer:
winner = random.choice(player_list)
else:
winner = winner
except Winner.DoesNotExist:
pass


Here what I want is if check_winner exists then again randomly select the winner from player but excluding that check_winner


How can I exclude some value from random list of players





Aucun commentaire:

Enregistrer un commentaire