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


Python ResponseMappingType.morelikethis方法代码示例

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


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

示例1: response_view

# 需要导入模块: from fjord.feedback.models import ResponseMappingType [as 别名]
# 或者: from fjord.feedback.models.ResponseMappingType import morelikethis [as 别名]
def response_view(request, responseid, template):
    response = get_object_or_404(Response, id=responseid)
    mlt = None
    records = None

    if (request.user.is_authenticated()
        and request.user.has_perm('analytics.can_view_dashboard')):

        mlt = ResponseMappingType.morelikethis(response)
        records = [
            (u'Response records', Record.objects.records(response)),
        ]
        jobs = GengoJob.objects.filter(
            object_id=response.id,
            content_type=ContentType.objects.get_for_model(response)
        )
        for job in jobs:
            records.append(
                (u'Gengo job record {0}'.format(job.id), job.records)
            )

    # We don't pass the response directly to the template and instead
    # do some data tweaks here to make it more palatable for viewing.
    return render(request, template, {
        'response': response,
        'mlt': mlt,
        'records': records,
    })
开发者ID:B-Rich,项目名称:fjord,代码行数:30,代码来源:views.py

示例2: response_view

# 需要导入模块: from fjord.feedback.models import ResponseMappingType [as 别名]
# 或者: from fjord.feedback.models.ResponseMappingType import morelikethis [as 别名]
def response_view(request, responseid, template):
    response = get_object_or_404(Response, id=responseid)

    try:
        prod = Product.objects.get(db_name=response.product)

        if (not prod.on_dashboard
                and (not request.user.is_authenticated()
                     or not request.user.has_perm(
                         'analytics.can_view_dashboard'))):

            # If this is a response for a hidden product and the user
            # isn't in the analytics group, then they can't see it.
            return HttpResponseForbidden()

    except Product.DoesNotExist:
        pass

    mlt = None
    records = None
    errors = []

    if (request.user.is_authenticated()
            and request.user.has_perm('analytics.can_view_dashboard')):

        try:
            # Convert it to a list to force it to execute right now.
            mlt = ResponseMappingType.reshape(
                ResponseMappingType.morelikethis(response))
        except ElasticsearchException as exc:
            errors.append('Failed to do morelikethis: %s' % exc)

        records = [
            (u'Response records', Record.objects.records(response)),
        ]
        jobs = GengoJob.objects.filter(
            object_id=response.id,
            content_type=ContentType.objects.get_for_model(response)
        )
        for job in jobs:
            records.append(
                (u'Gengo job record {0}'.format(job.id), job.records)
            )

    # We don't pass the response directly to the template and instead
    # do some data tweaks here to make it more palatable for viewing.
    return render(request, template, {
        'errors': errors,
        'response': response,
        'mlt': mlt,
        'records': records,
    })
开发者ID:DerekRies,项目名称:fjord,代码行数:54,代码来源:views.py

示例3: response_view

# 需要导入模块: from fjord.feedback.models import ResponseMappingType [as 别名]
# 或者: from fjord.feedback.models.ResponseMappingType import morelikethis [as 别名]
def response_view(request, responseid, template):
    response = get_object_or_404(Response, id=responseid)
    mlt = None

    if (request.user.is_authenticated()
        and request.user.has_perm('analytics.can_view_dashboard')):

        mlt = ResponseMappingType.morelikethis(response)

    # We don't pass the response directly to the template and instead
    # do some data tweaks here to make it more palatable for viewing.
    return render(request, template, {
        'response': response,
        'mlt': mlt,
    })
开发者ID:Nnamso,项目名称:fjord,代码行数:17,代码来源:views.py

示例4: response_view

# 需要导入模块: from fjord.feedback.models import ResponseMappingType [as 别名]
# 或者: from fjord.feedback.models.ResponseMappingType import morelikethis [as 别名]
def response_view(request, responseid, template):
    response = get_object_or_404(Response, id=responseid)

    mlt = None
    records = None
    errors = []

    if (request.user.is_authenticated()
            and request.user.has_perm('analytics.can_view_dashboard')):

        try:
            # Convert it to a list to force it to execute right now.
            mlt = ResponseMappingType.reshape(
                ResponseMappingType.morelikethis(response))
        except ElasticsearchException as exc:
            errors.append('Failed to do morelikethis: %s' % exc)

        records = [
            (u'Response records', Record.objects.records(response)),
        ]
        jobs = GengoJob.objects.filter(
            object_id=response.id,
            content_type=ContentType.objects.get_for_model(response)
        )
        for job in jobs:
            records.append(
                (u'Gengo job record {0}'.format(job.id), job.records)
            )

    # We don't pass the response directly to the template and instead
    # do some data tweaks here to make it more palatable for viewing.
    return render(request, template, {
        'errors': errors,
        'response': response,
        'mlt': mlt,
        'records': records,
    })
开发者ID:rlr,项目名称:fjord,代码行数:39,代码来源:views.py


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