本文整理汇总了Python中models.Person.person_ID方法的典型用法代码示例。如果您正苦于以下问题:Python Person.person_ID方法的具体用法?Python Person.person_ID怎么用?Python Person.person_ID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Person
的用法示例。
在下文中一共展示了Person.person_ID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: populate_person
# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import person_ID [as 别名]
def populate_person(root) :
"""
Finds instances of Person in root's tree and saves them to the database
@type root: Element
@param root: root of the ElementTree passed in to populate_models()
@rtype: N/A
@return: function does not return
"""
for person in root.findall("Person"):
temp_person = Person()
temp_person.person_ID = person.get("ID")
temp_person.name = person.get("Name")
if person.find("Kind") is not None :
temp_person.kind = person.find("Kind").text
if person.find("Location") is not None :
temp_person.location = person.find("Location").text
for crisis in person.iter("Crisis") :
temp_relations = Relations()
check = Relations.objects.filter(crisis_ID = crisis.get("ID"), person_ID = person.get("ID"))
if len(check) == 0:
temp_relations.populate(c_id = crisis.get("ID"), p_id = person.get("ID"))
temp_relations.save()
for org in person.iter("Org") :
temp_relations = Relations()
check = Relations.objects.filter(org_ID = org.get("ID"), person_ID = person.get("ID"))
if len(check) == 0:
temp_relations.populate(p_id = person.get("ID"), o_id = org.get("ID"))
temp_relations.save()
populate_common(person, person.get("ID"), temp_person)
temp_person.save()