def create_user(cls, email, password, admin=False):
     try:
         with DATABASE.transaction():
             cls.create(email=email,
                        password=make_hash(password),
                        admin=admin)
     except IntegrityError:
         raise ValueError("User already exists.")
示例#2
0
 def create_user(cls, username, email, password, admin=False):
     try:
         cls.create(
             username=username,
             email=email,
             password=make_hash(password),
             is_admin=admin)
     except peewee.IntegrityError:
         raise ValueError('User already exists')
示例#3
0
 def create_user(cls, email, password, admin=False):
     try:
         with DATABASE.transaction():
             cls.create(
                 email=email,
                 password=make_hash(password),
                 admin=admin)
     except IntegrityError:
         raise ValueError("User already exists.")