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
