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


Python User.query方法代码示例

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


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

示例1: get_user_choices

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
def get_user_choices():
    """
        Return the a list of values for the contractor autocomplete widget
    """
    choices = [(0, u'Tous les entrepreneurs')]
    choices.extend([(unicode(user.id),
                     u"{0} {1}".format(user.lastname, user.firstname),)
                        for user in User.query().all()])
    return choices
开发者ID:mike-perdide,项目名称:autonomie,代码行数:11,代码来源:holiday.py

示例2: unique_login

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
def unique_login(node, value):
    """
        Test login unicity against database
    """
    result = User.query(only_active=False).filter_by(login=value).first()
    if result:
        message = u"Le login '{0}' n'est pas disponible.".format(
                                                            value)
        raise colander.Invalid(node, message)
开发者ID:mike-perdide,项目名称:autonomie,代码行数:11,代码来源:user.py

示例3: test_gen_cancelinvoice_payment

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
def test_gen_cancelinvoice_payment(dbsession, invoice):
    user = User.query().first()
    project = Project.query().first()
    invoice.project = project
    invoice.owner = user
    invoice.statusPersonAccount = user
    invoice.record_payment(mode="c", amount=1500)
    cinv = invoice.gen_cancelinvoice(user)
    assert len(cinv.lines) ==  len(invoice.lines) + len(invoice.discounts) + 1
    assert cinv.lines[-1].cost == 1500
开发者ID:w3bcr4ft,项目名称:autonomie,代码行数:12,代码来源:test_invoice.py

示例4: test_company_index

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
def test_company_index(config, content, get_csrf_request_with_db):
    from autonomie.views.company import company_index
    avatar = User.query().first()
    config.add_route('company', '/company/{cid}')
    config.add_static_view('static', 'autonomie:static')
    request = get_csrf_request_with_db()
    request._user = avatar
    request.user = avatar
    request.context = avatar.companies[0]
    response = company_index(request)
    assert avatar.companies[0].name == response['company'].name
开发者ID:w3bcr4ft,项目名称:autonomie,代码行数:13,代码来源:test_company.py

示例5: test_gen_cancelinvoice_payment

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
 def test_gen_cancelinvoice_payment(self):
     user = User.query().first()
     project = Project.query().first()
     inv = self.getOne()
     inv.project = project
     inv.owner = user
     inv.statusPersonAccount = user
     inv.record_payment(mode="c", amount=1500)
     cinv = inv.gen_cancelinvoice(user)
     self.assertEqual(len(cinv.lines),
                       len(inv.lines) + len(inv.discounts) + 1)
     self.assertEqual(cinv.lines[-1].cost, 1500)
开发者ID:mike-perdide,项目名称:autonomie,代码行数:14,代码来源:test_invoice.py

示例6: auth

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
def auth(form, value):
    """
        Check the login/password content
    """
    log.debug(u" * Authenticating")
    login = value.get('login')
    log.debug(u"   +  Login {0}".format(login))
    password = value.get('password')
    result = User.query().filter_by(login=login).first()
    if not result or not result.auth(password):
        log.debug(u"    - Authentication Error")
        message = u"Erreur d'authentification"
        exc = colander.Invalid(form, message)
        exc['password'] = message
        raise exc
开发者ID:mike-perdide,项目名称:autonomie,代码行数:17,代码来源:user.py

示例7: upgrade

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
def upgrade():
    logger = logging.getLogger("alembic.migrate_code_compta")
    op.add_column("company", sa.Column("code_compta", sa.String(30), default=0))
    dbsession = DBSESSION()
    for user in User.query():
        code_compta = user.code_compta
        companies = user.companies
        if code_compta not in [u"0", None, u""]:
            if len(companies) == 1:
                company = companies[0]
                company.code_compta = code_compta
                dbsession.merge(company)
            else:
                logger.warn(u"User {0} has a code_compta and multiple \
companies".format(user.id))
开发者ID:mike-perdide,项目名称:autonomie,代码行数:17,代码来源:1_6_migrate_code_com_29299007fe7d.py

示例8: test_gen_cancelinvoice

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
def test_gen_cancelinvoice(dbsession, invoice):
    user = User.query().first()
    project = Project.query().first()
    invoice.project = project
    invoice.owner = user
    invoice.statusPersonAccount = user
    dbsession.add(invoice)
    dbsession.flush()
    cinv = invoice.gen_cancelinvoice(user)
    dbsession.add(cinv)
    dbsession.flush()

    assert cinv.name == "Avoir 1"
    assert cinv.total_ht() == -1 * invoice.total_ht()
    today = datetime.date.today()
    assert cinv.taskDate == today
开发者ID:w3bcr4ft,项目名称:autonomie,代码行数:18,代码来源:test_invoice.py

示例9: test_gen_cancelinvoice

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
    def test_gen_cancelinvoice(self):
        user = User.query().first()
        project = Project.query().first()
        inv = self.getOne()
        inv.project = project
        inv.owner = user
        inv.statusPersonAccount = user

        self.session.add(inv)
        self.session.flush()
        cinv = inv.gen_cancelinvoice(user)
        self.session.add(cinv)
        self.session.flush()

        self.assertEqual(cinv.name, "Avoir 1")
        self.assertEqual(cinv.total_ht(), -1 * inv.total_ht())
        today = datetime.date.today()
        self.assertEqual(cinv.taskDate, today)
开发者ID:mike-perdide,项目名称:autonomie,代码行数:20,代码来源:test_invoice.py

示例10: user

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
def user(content):
    return User.query().first()
开发者ID:w3bcr4ft,项目名称:autonomie,代码行数:4,代码来源:test_holiday.py

示例11: user

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
 def user(self):
     return User.query().first()
开发者ID:mike-perdide,项目名称:autonomie,代码行数:4,代码来源:test_expense.py

示例12: query

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
 def query(self):
     """
         Return the main query for our list view
     """
     return User.query(ordered=False, only_active=False)\
             .outerjoin(User.companies)
开发者ID:mike-perdide,项目名称:autonomie,代码行数:8,代码来源:user.py

示例13: getone

# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import query [as 别名]
 def getone(self):
     return User.query().filter(User.login==USER['login']).first()
开发者ID:mike-perdide,项目名称:autonomie,代码行数:4,代码来源:test_user.py


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