当前位置: 首页>>代码示例>>Python>>正文


Python User.select方法代码示例

本文整理汇总了Python中model.User.select方法的典型用法代码示例。如果您正苦于以下问题:Python User.select方法的具体用法?Python User.select怎么用?Python User.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.User的用法示例。


在下文中一共展示了User.select方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: populate

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
    def populate(self):
        # clear the existing cache
        for x in range(0, len(self)):
            self.pop()

        if self.location != 'global':
            location = Location.get(self.location)
            if location.is_region:
                hubs = location.has_hubs
                profile_select = User.select(AND(IN(User.q.homeplaceID, hubs),
                    User.q.public_field==1,
                    User.q.active==1,
                    User.q.description != u"",
                    User.q.modified > datetime.datetime.now() - datetime.timedelta(days=365))).orderBy('modified').reversed()[:30]
            else:
                profile_select = User.select(AND(User.q.homeplaceID==location,
                    User.q.public_field==1,
                    User.q.active==1,
                    User.q.description != u"",
                    User.q.modified > datetime.datetime.now() - datetime.timedelta(days=365))).orderBy('modified').reversed()[:30]
        else:
            profile_select = User.select(AND(User.q.public_field==1,
                    User.q.active==1,
                    User.q.description != u"",
                    User.q.modified > datetime.datetime.now() - datetime.timedelta(days=365))).orderBy('modified').reversed()[:30]
        for profile in profile_select:
            cache_obj = self.objectcache_factory(profile)
            self.append(cache_obj)
开发者ID:salfield,项目名称:hubspace,代码行数:30,代码来源:feeds.py

示例2: admin

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
def admin(user):
    """ Show the admin page """
    # This where clause should be (User.is_active is True) to comply
    # with PEP-8, but peewee doesn't support that syntax.
    users = User.select().where(User.is_active == True).order_by(User.name)
    return template.render(
        "admin.tpl", users=users, title="Admin", user=user, email_url=(settings.EMAIL_PATH if settings.DEBUG else None)
    )
开发者ID:TeachBoost,项目名称:ansible,代码行数:10,代码来源:admin.py

示例3: verify_password

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
def verify_password(username, alleged_password):
    try:
        user = User.select().where(User.username == username).get()
        verification = (crypt(alleged_password, user.password) == user.password)
        logging.debug('verify_password: username={}, encrypted_password={}, alleged_password={}, verification={}'.format(username, user.password, alleged_password, verification))

        if verification:
            AuthExt.save(user=user)

        return verification
    except Exception as e:
        logging.exception('verify_password')
        return False
开发者ID:CaveMike,项目名称:flask_rest,代码行数:15,代码来源:app.py

示例4: job

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
    def job(self):
        # This where clause should be (User.is_active is True) to comply
        # with PEP-8, but peewee doesn't support that syntax.
        users = User.select().where(User.is_active == True)

        # Send Email Digests (if necessary)
        for user in filter(lambda user: user.is_due(self.now), users):
            if self.send_email(user, self.create_digest, Subjects.DIGEST):
                user.update_last_sent(self.now)

        # Send Reminders (if necessary)
        for user in filter(lambda user: user.is_late(self.now), users):
            if self.send_email(user, self.create_reminder, Subjects.REMINDER):
                user.update_last_reminded(self.now)
开发者ID:TeachBoost,项目名称:ansible,代码行数:16,代码来源:cron.py

示例5: locate_user

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
def locate_user(username, apikey):
    '''
    Select user from database using Username + API Key.
    Returns None upon failure.
    '''
    if not username or not apikey:
        logging.info('Trying to locate user but Username/APIKey empty.')
        return None

    results = User.select().join(ApiKey).where((User.username==username) & (ApiKey.key==apikey))

    if results.count() != 1:
        logging.info("Unable to locate user.")
        return None

    return results[0]
开发者ID:bostrt,项目名称:koala,代码行数:18,代码来源:koala.py

示例6: get

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
 def get(self):
     page = int(self.get_argument("page", 1))
     pagesize = self.settings['admin_pagesize']
     keyword = self.get_argument("keyword", None)
     
     ft = (User.id > 0)
     
     if keyword:
         keyword = keyword + '%'
         ft = ft & (User.mobile % keyword)
     
     uq = User.select().where(ft)
     total = uq.count()
     users = uq.paginate(page, pagesize).order_by(User.signuped.desc())
     
     self.render('admin/user.html', users = users, total = total, page = page, pagesize = pagesize)
开发者ID:FashtimeDotCom,项目名称:cakeshop,代码行数:18,代码来源:admin.py

示例7: index

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
    def index(self, program=None):
        program = util.session("current_program", identity.current.user.programID, program)
        if identity.in_group("global_admin") and int(program) == 0:
            userlist = User.select()
            program = identity.current.user.programID
        elif int(program) == 0:
            program = identity.current.user.programID
            userlist = User.selectBy(programID=program)
        else:
            userlist = User.selectBy(programID=program)
        programlist = Program.select()

        return dict(
            program=Program.get(program),
            programlist=programlist,
            curProg=self.curProg,
            userlist=userlist,
            shaded=util.shaded,
        )
开发者ID:swsnider,项目名称:portfolio,代码行数:21,代码来源:userlist.py

示例8: syncUserGotchis

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
def syncUserGotchis():
    print "add missing gotchis"
    for person in User.select():
        downloadGotchi(person.id)
开发者ID:haxel,项目名称:spaceplace,代码行数:6,代码来源:sync.py

示例9: validate_email

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
    def validate_email(form, field):
        cnt = User.select().where(User.email == field.data).count()

        if cnt:
            raise ValidationError("This email is already in use.")
开发者ID:Mvalliere,项目名称:5-Minute-Hobbies,代码行数:7,代码来源:forms.py

示例10: validate_username

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import select [as 别名]
    def validate_username(form, field):
        cnt = User.select().where(User.username == field.data).count()

        if cnt:
            raise ValidationError("This username is already in use.")
开发者ID:Mvalliere,项目名称:5-Minute-Hobbies,代码行数:7,代码来源:forms.py


注:本文中的model.User.select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。