当前位置: 首页>>代码示例>>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;未经允许,请勿转载。