it/itf/profiles/utils.py
2011-03-06 18:23:57 +05:30

11 lines
242 B
Python

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