Skip to content

Instantly share code, notes, and snippets.

@iwillig
Created August 18, 2010 17:13
Show Gist options
  • Save iwillig/535465 to your computer and use it in GitHub Desktop.
Save iwillig/535465 to your computer and use it in GitHub Desktop.
tokens = Token.objects.all()
tokenSet = set([x.token for x in tokens])
def make_token(value):
tokenInt = random.randrange(1,100000000)
if tokenInt not in tokenSet:
token = Token(token=tokenInt,value=value)
token.save()
else:
make_token(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment