本文整理汇总了Python中person.models.Person.document方法的典型用法代码示例。如果您正苦于以下问题:Python Person.document方法的具体用法?Python Person.document怎么用?Python Person.document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person.models.Person
的用法示例。
在下文中一共展示了Person.document方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from person.models import Person [as 别名]
# 或者: from person.models.Person import document [as 别名]
def parse(klass, row, carrier, areacode, phone_type):
row = list(row) # Make row mutable
person = Person()
person.name = normalize_text(row[2])
address = Address()
address.location = normalize_text(row[3])
address.neighborhood = normalize_text(row[4])
address.city = normalize_text(row[5])
address.state = normalize_text(row[6])
phone = Phone()
phone.carrier = carrier
phone.areacode = areacode
phone.type = phone_type
try:
# document - try CPF
person.document = validate_cpf(row[8][-11:])
person.nature = Person.NATURE_CHOICES_PHYSICAL[0]
except CPFValidationError:
# document - try CNPJ
person.document = validate_cnpj(row[8][-14:])
person.nature = Person.NATURE_CHOICES_LEGAL[0]
address.zipcode = validate_zipcode(row[7])
phone.number = validate_phone_number(row[1])
return klass(row, person, address, phone)