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


Python ReportCard.find_by_id方法代码示例

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


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

示例1: test_add_owner

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def test_add_owner(self):
     self.makeAdmin()
     c = ReportCard.find_by_id(ReportCard.create(name='Add Owner Test Name').id())
     self.assertEqual(1, len(c.owner_user_id))
     response = self.testapp.post('/card/%d/add_owner' % c.key().id(), {'new_owner_id':'newowner'})
     self.assertRedirect('/card/list$', response)
     c = ReportCard.find_by_id(c.key().id())
     self.assertEqual(2, len(c.owner_user_id))
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:10,代码来源:card_handler_test.py

示例2: create

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def create(self, name, score, card_id):
     key_level = EvalKeyLevel(parent=self.report_key())
     key_level.name = name
     key_level.score = score
     card = ReportCard.find_by_id(card_id)
     key_level.card = card
     return key_level.put()
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:eval_key_level.py

示例3: test_add

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def test_add(self):
     response = self.testapp.get('/card/%d/key_level/add' % self.card_id, {'name': 'Add Test Name', 'score': 1})
     self.assertSuccess(response)
     card = ReportCard.find_by_id(self.card_id)
     self.assertEqual(1, len(card.key_levels()))
     self.assertEqual('Add Test Name', card.key_levels()[0].name)
     self.assertEqual(1, card.key_levels()[0].score)
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:key_handler_test.py

示例4: add

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         text_line_id = TextLine.create(self.request.get('name'), int(card_id)).id()
         text_line = TextLine.find_by_id(text_line_id)
         template = JinjaEnv.get().get_template('templates/text_line/edit_row.html')
         self.response.out.write(template.render({'text_line': text_line}))
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:text_line_handler.py

示例5: edit

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def edit(self, card_id):
     # TODO: handle this some other way
     AppUser.record_access(users.get_current_user())
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/card/edit_form.html')
         self.response.out.write(template.render({'card': card}))
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:card_handler.py

示例6: add

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         signature_id = Signature.create(self.request.get('name'), int(card_id)).id()
         signature = Signature.find_by_id(signature_id)
         template = JinjaEnv.get().get_template('templates/signature/edit_row.html')
         self.response.out.write(template.render({'signature': signature}))
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:signature_handler.py

示例7: add

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         category_id = EvalCategory.create(self.request.get('name'), int(card_id)).id()
         category = EvalCategory.find_by_id(category_id)
         template = JinjaEnv.get().get_template('templates/category/edit_table.html')
         self.response.out.write(template.render({'category': category}))
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:category_handler.py

示例8: add_owner

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def add_owner(self, card_id):
     if AppUser.for_user(users.get_current_user()).is_admin:
         card = ReportCard.find_by_id(int(card_id))
         card.owner_user_id.append(self.request.get('new_owner_id'))
         card.put()
         ReportCard.create(self.request.get('name'))
         return webapp2.redirect_to('card-list')
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:card_handler.py

示例9: test_edit

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def test_edit(self):
     item_id = EvalItem.create("Edit Test Name", self.category_id).id()
     response = self.testapp.post("/item/%d/edit" % item_id, {"name": "Edit Test New Name"})
     self.assertSuccess(response)
     category = ReportCard.find_by_id(self.card_id).categories()[0]
     self.assertEqual(1, len(category.items()))
     self.assertEqual("Edit Test New Name", category.items()[0].name)
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:item_handler_test.py

示例10: test_edit

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def test_edit(self):
     signature_id = Signature.create('Edit Test Name', self.card_id).id()
     response = self.testapp.post('/signature/%d/edit' % signature_id, {'name': 'Edit Test New Name'})
     self.assertSuccess(response)
     card = ReportCard.find_by_id(self.card_id)
     self.assertEqual(1, len(card.signatures()))
     self.assertEqual('Edit Test New Name', card.signatures()[0].name)
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:signature_handler_test.py

示例11: test_edit

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def test_edit(self):
     text_line_id = TextLine.create('Edit Test Name', self.card_id).id()
     response = self.testapp.post('/text_line/%d/edit' % text_line_id, {'name': 'Edit Test New Name'})
     self.assertSuccess(response)
     card = ReportCard.find_by_id(self.card_id)
     self.assertEqual(1, len(card.text_lines()))
     self.assertEqual('Edit Test New Name', card.text_lines()[0].name)
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:text_line_handler_test.py

示例12: add

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         key_level_id = EvalKeyLevel.create(self.request.get('name'), int(self.request.get('score')), int(card_id)).id()
         key_level = EvalKeyLevel.find_by_id(key_level_id)
         template = JinjaEnv.get().get_template('templates/key_level/edit_row.html')
         self.response.out.write(template.render({'key_level': key_level}))
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:9,代码来源:key_handler.py

示例13: test_edit

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def test_edit(self):
     key_level_id = EvalKeyLevel.create('Edit Test Name', 1, self.card_id).id()
     response = self.testapp.post('/key_level/%d/edit' % key_level_id, {'name': 'Edit Test New Name', 'score': 2})
     self.assertSuccess(response)
     card = ReportCard.find_by_id(self.card_id)
     self.assertEqual(1, len(card.key_levels()))
     self.assertEqual('Edit Test New Name', card.key_levels()[0].name)
     self.assertEqual(2, card.key_levels()[0].score)
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:10,代码来源:key_handler_test.py

示例14: create

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def create(self, name, card_id):
     category = EvalCategory(parent=self.report_key())
     category.name = name
     card = ReportCard.find_by_id(card_id)
     category.card = card
     if len(card.categories()) > 0:
         category.position = card.categories()[-1].position+1
     return category.put()
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:10,代码来源:eval_category.py

示例15: create

# 需要导入模块: from models.report_card import ReportCard [as 别名]
# 或者: from models.report_card.ReportCard import find_by_id [as 别名]
 def create(self, name, card_id):
     text_line = TextLine(parent=self.report_key())
     text_line.name = name
     card = ReportCard.find_by_id(card_id)
     text_line.card = card
     if len(card.text_lines()) > 0:
         text_line.position = card.text_lines()[-1].position+1
     return text_line.put()
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:10,代码来源:text_line.py


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