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


Python Student.name方法代码示例

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


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

示例1: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import name [as 别名]
    def post(self):
        """Handles POST requests."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return

        if not self.assert_xsrf_token_or_fail(self.request, 'register-post'):
            return

        can_register = self.app_context.get_environ(
            )['reg_form']['can_register']
        if not can_register:
            self.template_value['course_status'] = 'full'
        else:
            name = self.request.get('form01')
            surname = self.request.get('form02')
            age = self.request.get('form03')

            # create new or re-enroll old student
            student = Student.get_by_email(user.email())
            if not student:
                student = Student(key_name=user.email())
                student.user_id = user.user_id()

            student.is_enrolled = False
            student.name = name
            student.surname = surname
            student.age = age
            student.put()

        # Render registration confirmation page
        self.template_value['navbar'] = {'registration': True}
        self.render('confirmation.html')
开发者ID:osushkov,项目名称:greekcoursebuilder,代码行数:36,代码来源:utils.py

示例2: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import name [as 别名]
    def post(self):
        """Handles POST requests."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return

        if not self.assert_xsrf_token_or_fail(self.request, "register-post"):
            return

        can_register = self.app_context.get_environ()["reg_form"]["can_register"]
        if not can_register:
            self.template_value["course_status"] = "full"
        else:
            name = self.request.get("form01")

            # create new or re-enroll old student
            student = Student.get_by_email(user.email())
            if not student:
                student = Student(key_name=user.email())
                student.user_id = user.user_id()

            student.is_enrolled = True
            student.name = name
            student.put()

        # Render registration confirmation page
        self.template_value["navbar"] = {"registration": True}
        self.render("confirmation.html")
开发者ID:roderickfanou,项目名称:Learning_analytics_on_GCB,代码行数:31,代码来源:utils.py

示例3: create_or_enroll_student

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import name [as 别名]
    def create_or_enroll_student(self, user, name):
        # create new or re-enroll old student
        student = Student.get_by_email(user.email())
        if not student:
            student = Student(key_name=user.email())
            student.user_id = user.user_id()

            # Add to global student
            namespace = namespace_manager.get_namespace()
            try:
                namespace_manager.set_namespace("")
                global_student = Student(key_name=user.email())
                global_student.user_id = user.user_id()
                global_student.name = name
                global_student.put()
            finally:
                namespace_manager.set_namespace(namespace)

        student.is_enrolled = True
        student.name = name
        student.put()
开发者ID:sesamesushi,项目名称:satisrevude,代码行数:23,代码来源:utils.py

示例4: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import name [as 别名]
    def post(self):
        """Handles POST requests."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(
                users.create_login_url(self.request.uri), normalize=False)
            return

        if not self.assert_xsrf_token_or_fail(self.request, 'register-post'):
            return

        can_register = self.app_context.get_environ(
            )['reg_form']['can_register']
        if not can_register:
            self.template_value['course_status'] = 'full'
        else:
            name = self.request.get('form01')
            additional_fields = transforms.dumps(self.request.POST.items())

            # create new or re-enroll old student
            student = Student.get_by_email(user.email())
            if not student:
                student = Student(key_name=user.email())
                student.user_id = user.user_id()

            student_by_uid = Student.get_student_by_user_id(user.user_id())
            is_valid_student = (student_by_uid is None or
                                student_by_uid.user_id == student.user_id)
            assert is_valid_student, (
                'Student\'s email and user id do not match.')

            student.user_id = user.user_id()
            student.is_enrolled = True
            student.name = name
            student.additional_fields = additional_fields
            student.put()

        # Render registration confirmation page
        self.template_value['navbar'] = {'registration': True}
        self.render('confirmation.html')
开发者ID:ksh,项目名称:gpirecertification,代码行数:42,代码来源:utils.py

示例5: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import name [as 别名]
    def post(self):
        """Handles POST requests."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri), normalize=False)
            return

        if not self.assert_xsrf_token_or_fail(self.request, "register-post"):
            return

        can_register = self.app_context.get_environ()["reg_form"]["can_register"]
        if not can_register:
            self.template_value["course_status"] = "full"
        else:
            name = self.request.get("form01")
            additional_fields = transforms.dumps(self.request.POST.items())

            # create new or re-enroll old student
            student = Student.get_by_email(user.email())
            if not student:
                student = Student(key_name=user.email())
                student.user_id = user.user_id()

            student_by_uid = Student.get_student_by_user_id(user.user_id())
            is_valid_student = student_by_uid is None or student_by_uid.user_id == student.user_id
            assert is_valid_student, "Student's email and user id do not match."

            student.user_id = user.user_id()
            student.is_enrolled = True
            student.name = name
            student.age = self.request.get("formAge")
            student.additional_fields = additional_fields
            student.put()

        # Render registration confirmation page
        self.template_value["navbar"] = {"registration": True}
        self.render("confirmation.html")
开发者ID:esacosta,项目名称:u-mooc,代码行数:39,代码来源:utils.py


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