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


Python Person.add方法代碼示例

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


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

示例1: save

# 需要導入模塊: from people.models import Person [as 別名]
# 或者: from people.models.Person import add [as 別名]
 def save(self):
     m = Series.objects.create(
             title=self.title, title_fr=self.title_fr,
             title_int=self.title_int, begin_year=self.begin_year,
             end_year=self.end_year, id_imdb=self.id_imdb,
             poster=self.poster, rating=self.rating,
             votes=self.votes, plot=self.plot,
             language=self.language, alias=self.alias,
             number_of_episodes=0, number_of_seasons=0)
     m.save()
     for idx, actor in enumerate(self.persons['cast']):
         p = Person.add(actor)
         SeriesContributors.objects.create(
                 person=p, series=m, function='A', rank=idx)
     for idx, director in enumerate(self.persons['director']):
         p = Person.add(director)
         SeriesContributors.objects.create(
                 person=p, series=m, function='D', rank=idx)
     for idx, writer in enumerate(self.persons['writer']):
         p = Person.add(writer)
         p.save()
         SeriesContributors.objects.create(
                 person=p, series=m, function='W', rank=idx)
     for genre in self.genres:
         g = Genre.add(genre)
         m.genres.add(g)
     return m
開發者ID:ercool,項目名稱:pandore,代碼行數:29,代碼來源:series_processor.py

示例2: save

# 需要導入模塊: from people.models import Person [as 別名]
# 或者: from people.models.Person import add [as 別名]
 def save(self):
     if __DEBUG__:
         print "title : " + self.title
         print "title_fr : " + self.title_fr
         print "title_int : " + self.title_int
         print "year : " + str(self.year)
         if self.runtime:
             print "runtime : " + self.runtime
         print "poster : " + self.poster
         if self.rating:
             print "rating : " + str(self.rating)
         if self.votes:
             print "votes : " + str(self.votes)
         print "plot : " + self.plot
         print "language : " + self.language
     m = Movie.objects.create(
             title=self.title, title_fr=self.title_fr,
             title_int=self.title_int, year=self.year,
             runtime=self.runtime, id_imdb=self.id_imdb,
             poster=self.poster, rating=self.rating,
             votes=self.votes, plot=self.plot,
             language=self.language)
     m.save()
     for idx, actor in enumerate(self.persons['cast']):
         p = Person.add(actor)
         MovieContributors.objects.create(
                 person=p, movie=m, function='A', rank=idx)
     for idx, director in enumerate(self.persons['director']):
         p = Person.add(director)
         MovieContributors.objects.create(
                 person=p, movie=m, function='D', rank=idx)
     for idx, writer in enumerate(self.persons['writer']):
         p = Person.add(writer)
         p.save()
         MovieContributors.objects.create(
                 person=p, movie=m, function='W', rank=idx)
     for genre in self.genres:
         g = Genre.add(genre)
         m.genres.add(g)
     return m
開發者ID:ercool,項目名稱:pandore,代碼行數:42,代碼來源:movies_processor.py


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