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


Python Person.normalize方法代码示例

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


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

示例1: getline

# 需要导入模块: from people.models import Person [as 别名]
# 或者: from people.models.Person import normalize [as 别名]
    def getline(self, row, fields):
        person = Person(
            lastname=self.getfield(fields, "nom", row),
            firstname=self.getfield(fields, "prenom", row),
            ptype="stu"
        )
        birthday = self.getfield(fields, "datenaissance", row)
        if birthday != "":
            person.birthday = birthday
        person.normalize()

        if "prenoms" in fields:
            person.prenoms = self.getfield(fields, "prenoms", row)
        if "uniquid" in fields:
            person.uniquid = self.getfield(fields, "uniquid", row)
        person = Person.add_or_update(person, self.importation.log.log)
        print "Cleaning old groups"
        self.cleanup_groups(Person)
        print "Getting groups"
        for fname in fields:
            if fname not in KNOWN_FIELDS:
                group = self.getfield(fields, fname, row)
                if group == "":
                    continue
                self.put_people_in_group(group, fname, person)
开发者ID:jmbarbier,项目名称:djeskoolz,代码行数:27,代码来源:csvstudent.py

示例2: getPerson

# 需要导入模块: from people.models import Person [as 别名]
# 或者: from people.models.Person import normalize [as 别名]
def getPerson(row, fields, importrec):
    Person, created = Person.objects.get_or_create(
        firstname=Person.normalize("firstname",
                                    getfield(fields, "nom", row)),
        lastname=Person.normalize("lastname",
                                   getfield(fields, "prenom", row)),
        birthday=Person.normalize("lastname",
                                   getfield(fields, "datenaissance", row))
    )
    if created:
        Person.sourcetype = "I"
        Person.sourceid = importrec.pk
        if "prenoms" in fields:
            Person.prenoms = Person.normalize("prenoms",
                getfield(fields, "prenoms", row))
        if "uniquid" in fields:
            Person.uniquid = Person.normalize("uniquid",
                getfield(fields, "uniquid", row))
        if "email" in fields:
            Person.email = Person.normalize("email",
                getfield(fields, "email", row))
        if "mobile" in fields:
            Person.mobile = Person.normalize("mobile",
                getfield(fields, "mobile", row))
        password = User.objects.make_random_password(length=8)
        Person.initpass = password
        Person.save()
        print "Created Person ", Person
    else:
        print "Existing Person", Person
开发者ID:jmbarbier,项目名称:djeskoolz,代码行数:32,代码来源:csvteacher.py


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