当前位置: 首页>>代码示例>>Python>>正文


Python Film.save_localized_title方法代码示例

本文整理汇总了Python中film20.core.models.Film.save_localized_title方法的典型用法代码示例。如果您正苦于以下问题:Python Film.save_localized_title方法的具体用法?Python Film.save_localized_title怎么用?Python Film.save_localized_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在film20.core.models.Film的用法示例。


在下文中一共展示了Film.save_localized_title方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: accept

# 需要导入模块: from film20.core.models import Film [as 别名]
# 或者: from film20.core.models.Film import save_localized_title [as 别名]
    def accept( self, user ):
        
        # generate permalink
        permalink = get_film_permalink( self )

        film = Film(
            title = self.title, 
            release_year = self.release_year, 
            image = self.image,
            version = 1,
            is_tv_series = ( self.type == self.TYPE_SERIES ),
            completion_year = self.completion_year if ( self.type == self.TYPE_SERIES ) else None,
            type = Film.TYPE_FILM, 
            permalink = permalink, 
            status = 1,
            production_country_list = ','.join( [ c.country for c in self.production_country.all() ] )
        )
        
        film.save()
        
        # add localized title
        if self.localized_title:
            film.save_localized_title( self.localized_title )

        # add directors
        for director in self.directors.all():
            film.directors.add( director )

            # ... and set director flag to true
            director.is_director = True
            director.save()

        # set countries
        for country in self.production_country.all():
            film.production_country.add( country )
        
        other_languages = get_other_languages()

        # set actors
        for actor in self.get_actors():
            # save charater in default LANG
            Character( 
                film = film, 
                person = actor.person, 
                importance = actor.importance, 
                character = actor.character
            ).save()

            # mark this person as actor
            actor.person.is_actor = True
            actor.save()

            # ... and in other languages
            for lang in other_languages:
                Character( 
                    film = film, 
                    person = actor.person, 
                    importance = actor.importance,
                    LANG=lang
                ).save()

        # set reference
        self.film = film

        super( AddedFilm, self ).accept( user )
开发者ID:yangjiandong,项目名称:filmaster,代码行数:67,代码来源:models.py


注:本文中的film20.core.models.Film.save_localized_title方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。