本文整理汇总了Python中models.report_card.ReportCard类的典型用法代码示例。如果您正苦于以下问题:Python ReportCard类的具体用法?Python ReportCard怎么用?Python ReportCard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReportCard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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')
示例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)
示例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))
示例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}))
示例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()
示例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)
示例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}))
示例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}))
示例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}))
示例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)
示例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)
示例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}))
示例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)
示例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)
示例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()