def new_code_for(user):
        hash = md5(str(time.time()) + settings.SECRET_KEY).hexdigest()

        try:
            code = user.email_verification_code
            code.hash = hash
            code.save()
        except EmailVerificationCode.DoesNotExist:
            code = EmailVerificationCode.objects.create(
                user=user,
                hash=hash)

        return code