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


Python DBSession.flush方法代码示例

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


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

示例1: test_add_primarykey_cr

# 需要导入模块: from por.models import DBSession [as 别名]
# 或者: from por.models.DBSession import flush [as 别名]
 def test_add_primarykey_cr(self):
     session = DBSession()
     project1 = Project(name=u'My project 11')
     cr1 = CustomerRequest(name=u'My Customer reqeust 1')
     cr1.project = project1
     cr2 = CustomerRequest(name=u'My Customer reqeust 2')
     cr2.project = project1
     project2 = Project(name=u'My project 12')
     cr3 = CustomerRequest(name=u'My Customer reqeust 1')
     cr3.project = project2
     session.add(cr1)
     session.add(cr2)
     session.add(cr3)
     session.flush()
     self.assertTrue(cr1.id in ['my-project-11_2','my-project-11_1'])
     self.assertTrue(cr2.id in ['my-project-11_2','my-project-11_1'])
     self.assertEqual(cr3.id, 'my-project-12_1')
开发者ID:getpenelope,项目名称:por.models,代码行数:19,代码来源:test_dashboard.py

示例2: TimeEntry

# 需要导入模块: from por.models import DBSession [as 别名]
# 或者: from por.models.DBSession import flush [as 别名]
    if crstate_errors:
        return {
                'state': False,
                'message': '\n'.join(crstate_errors),
                }

    time_entry = TimeEntry(date = entry_date,
                           hours = entry_time_delta,
                           location = entry_location,
                           description = entry_description,
                           ticket = entry_ticket)
    time_entry.request = request        # bind for user lookup

    time_entry.project_id = entry_project
    session.add(time_entry)
    session.flush()

    return {
            'status': True,
            'message': u'Correctly added time entry %s for %s ticket #%s' % (time_entry.id, entry_project, entry_ticket),
            }



@jsonrpc_method(endpoint='DashboardAPI')
def create_new_advanced_time_entry(request, entry_ticket, entry_start, entry_end,
                                   entry_description, entry_location, entry_project):
    """
    Time entry creation: simple time entry case
    """
开发者ID:getpenelope,项目名称:por.dashboard,代码行数:32,代码来源:api.py


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