def create_code(self):
if self.code:
raise FieldError
hash_input = (
"fim_rudi" + self.participant_1_email +
str(time.clock()) +
str(self.event) +
str(random.random()))
digest = sha256(hash_input).digest()
# if code already exists create another
new_code = base58.b58encode(digest)
if Team.objects.filter(code=new_code).exists():
return self.create_code()
self.code = new_code
评论列表
文章目录