本文整理汇总了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 )