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


Python Student.rename_current方法代码示例

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


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

示例1: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import rename_current [as 别名]
    def post(self):
        """Handles POST requests."""

        student = self.personalize_page_and_get_enrolled()
        if not student:
            return

        if not self.assert_xsrf_token_or_fail(self.request,
                'student-edit'):
            return

        if self.request.get('name'):
            Student.rename_current(self.request.get('name')) 
            
        if self.request.get('apellidos'):    
            Student.update_apellidos(self.request.get('apellidos')) 
            
        if self.request.get('ciudad'):    
            Student.update_ciudad(self.request.get('ciudad')) 
            
        if self.request.get('pais'):    
            Student.update_pais(self.request.get('pais')) 
            
        """
        EL SIGUIENTE CÓDIGO CALCULA LA NOTA MEDIA EN LOS EXÁMENES
            
        import datetime

        ayer = datetime.datetime.now() - datetime.timedelta(days=1)
        students = Student.all()
        logging.info(students)

        students = [s for s in Student.all()]
        logging.info(students)

        total_scores = {}
        count_scores = {}

        for s in students:
          scores = json.loads(s.scores) if s.scores else {} #puntuaciones de un usuario
          for asm_id, asm_score in scores.iteritems(): #para cada examen que ha realizado
            total_scores[asm_id] = total_scores.get(asm_id, 0) + asm_score
            count_scores[asm_id] = count_scores.get(asm_id, 0) + 1

        logging.info(total_scores)
        logging.info(count_scores)

        for asm_id, total_score in total_scores.iteritems():
          total_scores[asm_id] = total_score / count_scores[asm_id] #calcula la nota media en un examen

        logging.info(total_scores)
        
        """
            
            
        self.redirect('/student/home')
开发者ID:Domofera,项目名称:Domofera_MOOC,代码行数:58,代码来源:utils.py

示例2: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import rename_current [as 别名]
    def post(self):
        """Handles POST requests."""
        student = self.personalize_page_and_get_enrolled()
        if not student:
            return

        if not self.assert_xsrf_token_or_fail(self.request, 'student-edit'):
            return

        Student.rename_current(self.request.get('name'))

        self.redirect('/student/home')
开发者ID:ksh,项目名称:gpirecertification,代码行数:14,代码来源:utils.py

示例3: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import rename_current [as 别名]
    def post(self):
        """Handles POST requests."""
        student = self.personalize_page_and_get_enrolled()
        if not student:
            return

        if not self.assert_xsrf_token_or_fail(self.request, "student-edit"):
            return

        Student.rename_current(self.request.get("name"))
        Student.change_age_current(self.request.get("age"))
        Student.change_avatar_current(self.request.get("img"))

        self.redirect("/student/home")
开发者ID:esacosta,项目名称:u-mooc,代码行数:16,代码来源:utils.py


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