コード例 #1
0
ファイル: models.py プロジェクト: keikubo/django
 def make_random_password(self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'):
     """
     Generates a random password with the given length
     and given allowed_chars
     """
     # Note that default value of allowed_chars does not have "I" or letters
     # that look like it -- just to avoid confusion.
     return get_random_string(length, allowed_chars)
コード例 #2
0
def generate_code(sender, instance, raw, using, **kwargs):
    if instance.code:
        return

    # 10 tries for uniqueness
    for i in xrange(10):
        code = get_random_string(5)
        if Invite.objects.filter(code=code).count():
            continue

    instance.code = code
コード例 #3
0
ファイル: models.py プロジェクト: camd/mozillians
def generate_code(sender, instance, raw, using, **kwargs):
    if instance.code:
        return

    # 10 tries for uniqueness
    for i in xrange(10):
        code = get_random_string(5)
        if Invite.objects.filter(code=code).count():
            continue

    instance.code = code
コード例 #4
0
 def make_random_password(
     self,
     length=10,
     allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'
 ):
     """
     Generates a random password with the given length
     and given allowed_chars
     """
     # Note that default value of allowed_chars does not have "I" or letters
     # that look like it -- just to avoid confusion.
     return get_random_string(length, allowed_chars)