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


Python UserSettings.user_meets_plan方法代码示例

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


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

示例1: player

# 需要导入模块: from accounts.models import UserSettings [as 别名]
# 或者: from accounts.models.UserSettings import user_meets_plan [as 别名]
def player(req, episode_id):
    ep = get_object_or_404(PodcastEpisode, id=episode_id)
    resp = render(req, 'player.html', {'episode': ep})

    # If the user is not a demo user, allow the player to be used outside the app.
    if UserSettings.user_meets_plan(ep.podcast.owner, plans.FEATURE_MIN_PLAYER):
        resp.xframe_options_exempt = True
    return resp
开发者ID:Qbitus,项目名称:pinecast,代码行数:10,代码来源:views.py

示例2: ep_comment_box

# 需要导入模块: from accounts.models import UserSettings [as 别名]
# 或者: from accounts.models.UserSettings import user_meets_plan [as 别名]
def ep_comment_box(req, podcast_slug, episode_id):
    pod = get_object_or_404(Podcast, slug=podcast_slug)
    if not UserSettings.user_meets_plan(pod.owner, plans.FEATURE_MIN_COMMENT_BOX):
        raise Http404()
    ep = get_object_or_404(PodcastEpisode, podcast=pod, id=episode_id)
    if not req.POST:
        return _pmrender(req, 'feedback/comment_episode.html', {'podcast': pod, 'episode': ep})

    try:
        if not _validate_recaptcha(req):
            raise Exception('Invalid ReCAPTCHA')

        ip = analyze.get_request_ip(req)
        f = Feedback(
            podcast=pod,
            episode=ep,
            sender=req.POST.get('email'),
            message=req.POST.get('message'),
            sender_ip=ip
        )
        f.save()
        analytics_log.write('feedback', {
            'podcast': unicode(pod.id),
            'episode': unicode(ep.id),
            'profile': {
                'email': req.POST.get('email'),
                'email_host': req.POST.get('email').split('@')[1],
                'ip': ip,
                'ua': req.META.get('HTTP_USER_AGENT'),
            },
        }, req=req)
        send_notification_email(
            pod.owner,
            ugettext('[Pinecast] You got some feedback!'),
            'Go check the Feedback page of %s--an episode on %s--to see what was written.\n\n'
            'https://pinecast.com%s' %
                (ep.title,
                 pod.name,
                 reverse('podcast_episode',
                         podcast_slug=podcast_slug,
                         episode_id=str(ep.id)) +
                    '#tab-feedback')
        )
    except Exception:
        return _pmrender(req, 'feedback/comment_episode.html',
                         {'podcast': pod, 'episode': ep, 'error': True, 'default': req.POST})

    return _pmrender(req, 'feedback/thanks.html', {'podcast': pod})
开发者ID:Qbitus,项目名称:pinecast,代码行数:50,代码来源:views.py

示例3: podcast_comment_box

# 需要导入模块: from accounts.models import UserSettings [as 别名]
# 或者: from accounts.models.UserSettings import user_meets_plan [as 别名]
def podcast_comment_box(req, podcast_slug):
    pod = get_object_or_404(Podcast, slug=podcast_slug)
    if not UserSettings.user_meets_plan(pod.owner, plans.FEATURE_MIN_COMMENT_BOX):
        raise Http404()
    if not req.POST:
        return _pmrender(req, 'feedback/comment_podcast.html', {'podcast': pod})

    try:
        if not _validate_recaptcha(req):
            raise Exception('Invalid ReCAPTCHA')

        ip = analyze.get_request_ip(req)
        f = Feedback(
            podcast=pod,
            sender=req.POST.get('email'),
            message=req.POST.get('message'),
            sender_ip=ip
        )
        f.save()
        send_notification_email(
            pod.owner,
            ugettext('[Pinecast] You got some feedback!'),
            'Go check the Feedback page of your podcast, %s, to see what was written.\n\n'
            'https://pinecast.com%s' %
            (pod.name,
             reverse('podcast_dashboard', podcast_slug=podcast_slug) + '#tab-feedback')
        )

        NotificationHook.trigger_notification(
            podcast=pod,
            trigger_type='feedback',
            data={'content': req.POST.get('message'), 'sender': req.POST.get('email')})
    except Exception:
        return _pmrender(req, 'feedback/comment_podcast.html',
                         {'podcast': pod, 'error': True, 'default': req.POST})

    return _pmrender(req, 'feedback/thanks.html', {'podcast': pod})
开发者ID:Pinecast,项目名称:pinecast,代码行数:39,代码来源:views.py


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