當前位置: 首頁>>代碼示例>>Python>>正文


Python Person.add_or_update方法代碼示例

本文整理匯總了Python中people.models.Person.add_or_update方法的典型用法代碼示例。如果您正苦於以下問題:Python Person.add_or_update方法的具體用法?Python Person.add_or_update怎麽用?Python Person.add_or_update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在people.models.Person的用法示例。


在下文中一共展示了Person.add_or_update方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_addorupdate_same

# 需要導入模塊: from people.models import Person [as 別名]
# 或者: from people.models.Person import add_or_update [as 別名]
 def test_addorupdate_same(self):
     """ Testing duplicate detection """
     newone = copy.copy(self.people1)
     newone.pk = None
     newone.lastname = u"BARBIéR"
     addupdres = Person.add_or_update(newone)
     self.assertEqual(self.people1.pk, addupdres.pk)
開發者ID:jmbarbier,項目名稱:djeskoolz,代碼行數:9,代碼來源:test_people.py

示例2: getline

# 需要導入模塊: from people.models import Person [as 別名]
# 或者: from people.models.Person import add_or_update [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

示例3: test_addorupdate_married

# 需要導入模塊: from people.models import Person [as 別名]
# 或者: from people.models.Person import add_or_update [as 別名]
 def test_addorupdate_married(self):
     """ Testing duplicate married detection """
     newone = copy.copy(self.people1)
     newone.pk = None
     newone.birthname = newone.lastname
     newone.lastname = u"MACHIN"
     addupdres = Person.add_or_update(newone)
     self.assertEqual(self.people1.pk, addupdres.pk)
開發者ID:jmbarbier,項目名稱:djeskoolz,代碼行數:10,代碼來源:test_people.py

示例4: form_valid

# 需要導入模塊: from people.models import Person [as 別名]
# 或者: from people.models.Person import add_or_update [as 別名]
 def form_valid(self, form):
     user = form.save(commit=False)
     user.normalize()
     self.object = Person.add_or_update(user)
     return HttpResponseRedirect(self.get_success_url())
開發者ID:jmbarbier,項目名稱:djeskoolz,代碼行數:7,代碼來源:views.py


注:本文中的people.models.Person.add_or_update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。