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