it/itf/profiles/utils.py

11 lines
242 B
Python
Raw Permalink Normal View History

2011-03-06 12:53:57 +00:00
import ox
from models import Profile
import random
def generate_validate_token():
while True:
token = ox.to32(random.randint(32768, 1048575))
if Profile.objects.filter(validate_token=token).count() == 0:
break
return token