本文整理汇总了Python中Elaboration.models.Elaboration.search方法的典型用法代码示例。如果您正苦于以下问题:Python Elaboration.search方法的具体用法?Python Elaboration.search怎么用?Python Elaboration.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elaboration.models.Elaboration
的用法示例。
在下文中一共展示了Elaboration.search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: search
# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import search [as 别名]
def search(request, course_short_title=None):
course = Course.get_or_raise_404(short_title=course_short_title)
selected_challenge = request.POST['selected_challenge']
selected_user = request.POST['selected_user'].split()[0]
selected_tag = request.POST['selected_tag']
challenges = []
if(selected_challenge != 'task...'):
challenges = Challenge.objects.filter(title=selected_challenge[:(
request.POST['selected_challenge'].rindex('(') - 1)], course=course)
else:
challenges = Challenge.objects.filter(course=course)
user = []
if(selected_user != 'user...'):
user = AuroraUser.objects.filter(username=selected_user)
request.session['display_points'] = "true"
else:
user = AuroraUser.objects.all()
request.session['display_points'] = "false"
if(selected_tag != 'tag...'):
aurorauser_ct = ContentType.objects.get_for_model(AuroraUser)
tagged_items = TaggedItem.objects.filter(
content_type=aurorauser_ct, tag__name=selected_tag)
tagged_user_ids = []
for ti in tagged_items:
if not tagged_user_ids.__contains__(ti.content_object):
tagged_user_ids.append(ti.content_object.id)
tagged_user = AuroraUser.objects.filter(id__in=tagged_user_ids)
user = user & tagged_user
elaborations = []
if Elaboration.search(challenges, user):
elaborations = list(Elaboration.search(challenges, user))
# store selected elaborations in session
request.session['elaborations'] = serializers.serialize(
'json', elaborations)
request.session['selection'] = 'search'
request.session['selected_challenge'] = selected_challenge
request.session['selected_user'] = selected_user
request.session['selected_tag'] = selected_tag
return evaluation(request, course_short_title)