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


Python Film.get_next_film_to_rate方法代码示例

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


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

示例1: random_film_to_rate

# 需要导入模块: from film20.core.models import Film [as 别名]
# 或者: from film20.core.models.Film import get_next_film_to_rate [as 别名]
def random_film_to_rate(request):
    """
        Widget for main page (for not logged in users)
        displaying a film to rate, selected from
        the list of 10 most popular films.
    """

    user = request.user
    
    if user.is_authenticated():
        film = Film.get_next_film_to_rate(user)
    else:
        key = cache.Key("popular_films_list")

        popular_films = cache.get(key)

        if popular_films is None:
            fhelper = FilmHelper()
            lang = getattr(settings, 'LANGUAGE_CODE', 'en')
            if lang == 'en':
                popular_films = fhelper.get_popular_films(exclude_nonEnglish=True)
            else:
                popular_films = fhelper.get_popular_films()
            cache.set(key, popular_films)

        film = popular_films and random.choice(popular_films) or None

    return {
        'film': film, 
    }
开发者ID:thuvh,项目名称:filmmaster,代码行数:32,代码来源:movie.py

示例2: next_film_to_rate_url

# 需要导入模块: from film20.core.models import Film [as 别名]
# 或者: from film20.core.models.Film import get_next_film_to_rate [as 别名]
def next_film_to_rate_url(user):
    if settings.NEW_RATING_SYSTEM:
        films = BasketsRatingHelper.get_films_to_rate(user, 1)
        film = films and films[0] or None
    else:
        film = Film.get_next_film_to_rate(user)
    if film:
        return reverse('show_film', args=(film.permalink, ))
    else:
        return ''
开发者ID:thuvh,项目名称:filmmaster,代码行数:12,代码来源:movie.py

示例3: next_film_to_rate_url

# 需要导入模块: from film20.core.models import Film [as 别名]
# 或者: from film20.core.models.Film import get_next_film_to_rate [as 别名]
def next_film_to_rate_url(context, user):
    request = context['request']
    if settings.NEW_RATING_SYSTEM:
        rater = rating_helper.get_rater(request)
        films = rater.get_films_to_rate(1)
        film = films and films[0] or None
    else:
        film = Film.get_next_film_to_rate(user)
    
    if film:
        return film.get_absolute_path()
    else:
        return ''
开发者ID:yangjiandong,项目名称:filmaster,代码行数:15,代码来源:movie.py

示例4: next_film_to_rate

# 需要导入模块: from film20.core.models import Film [as 别名]
# 或者: from film20.core.models.Film import get_next_film_to_rate [as 别名]
def next_film_to_rate(request):
    film = Film.get_next_film_to_rate(request.user)
    if film:
        return HttpResponseRedirect(film.get_absolute_url())
    else:
        return render(request, "movies/no_more_to_rate.html")
开发者ID:yangjiandong,项目名称:filmaster,代码行数:8,代码来源:film_views.py

示例5: next_film_to_rate

# 需要导入模块: from film20.core.models import Film [as 别名]
# 或者: from film20.core.models.Film import get_next_film_to_rate [as 别名]
def next_film_to_rate(request):
    film = Film.get_next_film_to_rate(request.user)
    if film:
        return HttpResponseRedirect(reverse(show_film, args=[film.permalink]))
    else:
        return render(request, "movies/no_more_to_rate.html")
开发者ID:thuvh,项目名称:filmmaster,代码行数:8,代码来源:film_views.py


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