本文整理汇总了Python中models.report_card.ReportCard类的典型用法代码示例。如果您正苦于以下问题:Python ReportCard类的具体用法?Python ReportCard怎么用?Python ReportCard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReportCard类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: add_owner
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,代码行数:7,代码来源:card_handler.py
示例2: test_add
def test_add(self):
self.assertEqual(0, len(ReportCard.list_by_user()))
response = self.testapp.post('/card/add', {'name': 'Add Test Name'})
self.assertRedirect('/card/list$', response)
cards = ReportCard.list_by_user()
self.assertEqual(1, len(cards))
self.assertEqual('Add Test Name', cards[0].name)
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:7,代码来源:card_handler_test.py
示例3: test_add_owner
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,代码行数:8,代码来源:card_handler_test.py
示例4: add
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,代码行数:7,代码来源:signature_handler.py
示例5: create
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,代码行数:7,代码来源:eval_key_level.py
示例6: test_add
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,代码行数:7,代码来源:key_handler_test.py
示例7: add
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,代码行数:7,代码来源:text_line_handler.py
示例8: edit
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,代码行数:7,代码来源:card_handler.py
示例9: add
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,代码行数:7,代码来源:key_handler.py
示例10: test_edit
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,代码行数:7,代码来源:item_handler_test.py
示例11: test_edit
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,代码行数:7,代码来源:text_line_handler_test.py
示例12: add
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,代码行数:7,代码来源:category_handler.py
示例13: test_edit
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,代码行数:7,代码来源:signature_handler_test.py
示例14: test_edit
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,代码行数:8,代码来源:key_handler_test.py
示例15: create
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,代码行数:8,代码来源:text_line.py
示例16: create
def create(self, name, card_id):
signature = Signature(parent=self.report_key())
signature.name = name
card = ReportCard.find_by_id(card_id)
signature.card = card
if len(card.signatures()) > 0:
signature.position = card.signatures()[-1].position+1
return signature.put()
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:8,代码来源:signature.py
示例17: create
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,代码行数:8,代码来源:eval_category.py
示例18: test_move_down
def test_move_down(self):
category1_id = EvalCategory.create("Move Up Test Name 1", self.card_id).id()
category2_id = EvalCategory.create("Move Up Test Name 2", self.card_id).id()
self.assertRaises(Exception, self.testapp.post, "/category/%d/move_down" % category2_id)
response = self.testapp.post("/category/%d/move_down" % category1_id)
self.assertSuccess(response)
card = ReportCard.find_by_id(self.card_id)
categories = card.categories()
self.assertEqual(2, len(categories))
self.assertEqual(category2_id, categories[0].key().id())
self.assertEqual(category1_id, categories[1].key().id())
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:11,代码来源:category_handler_test.py
示例19: test_move_down
def test_move_down(self):
item1_id = EvalItem.create("Move Up Test Name 1", self.category_id).id()
item2_id = EvalItem.create("Move Up Test Name 2", self.category_id).id()
self.assertRaises(Exception, self.testapp.post, "/item/%d/move_down" % item2_id)
response = self.testapp.post("/item/%d/move_down" % item1_id)
self.assertSuccess(response)
category = ReportCard.find_by_id(self.card_id).categories()[0]
items = category.items()
self.assertEqual(2, len(items))
self.assertEqual(item2_id, items[0].key().id())
self.assertEqual(item1_id, items[1].key().id())
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:11,代码来源:item_handler_test.py
示例20: test_move_up
def test_move_up(self):
text_line1_id = TextLine.create('Move Up Test Name 1', self.card_id).id()
text_line2_id = TextLine.create('Move Up Test Name 2', self.card_id).id()
self.assertRaises(Exception, self.testapp.post, '/text_line/%d/move_up' % text_line1_id)
response = self.testapp.post('/text_line/%d/move_up' % text_line2_id)
self.assertSuccess(response)
card = ReportCard.find_by_id(self.card_id)
text_lines = card.text_lines()
self.assertEqual(2, len(text_lines))
self.assertEqual(text_line2_id, text_lines[0].key().id())
self.assertEqual(text_line1_id, text_lines[1].key().id())
开发者ID:emanderson,项目名称:preschool-report-card,代码行数:11,代码来源:text_line_handler_test.py
注:本文中的models.report_card.ReportCard类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论