當前位置: 首頁>>代碼示例>>Python>>正文


Python report_card.ReportCard類代碼示例

本文整理匯總了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')
開發者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


注:本文中的models.report_card.ReportCard類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。