示例#1
0
文件: views.py 项目: ddgromit/mimicme
def review(request):
    recordings = Recording.objects.filter(user = request.user)

    phrase_set = None
    if request.GET.get('set_id'):
        set_id = int(request.GET.get('set_id'))
        phrase_set = PhraseSet.objects.get(id=set_id)
        phrases = list(phrase_set.phrases.all())
        recordings = recordings.filter(phrase__in = phrases)


    recordingObjs = []
    for recording in recordings:
        media_url = lib.recording_url(recording.id)
        media_url_encoded = urllib.quote_plus(media_url)
        responses = Response.objects.filter(recording=recording).order_by('-created')
        responseObjs = [(response,lib.response_url(response.id)) for response in responses]

        # Additional params we want passed through to uploading
        upload_params = "phrase_id=" + str(recording.phrase.id)
        upload_params_encoded = urllib.quote_plus(upload_params)

        recordingObjs.append((
            recording,
            media_url_encoded,
            responseObjs,
            lib.expert_url(recording.phrase.id),
            upload_params_encoded,
        ))

    return render(request,'review.html',{
        'recordingObjs':recordingObjs,
        'phrase_set':phrase_set,
    })
示例#2
0
文件: views.py 项目: ddgromit/mimicme
def give_response(request):
    recordings = Recording.objects.order_by('-created')

    recordingObjs = []
    for recording in recordings:
        media_url = lib.recording_url(recording.id)
        media_url_encoded = urllib.quote_plus(media_url)
        responses = Response.objects.filter(recording=recording)
        responseObjs = [(response,lib.response_url(response.id)) for response in responses]

        # Additional params we want passed through to uploading
        upload_params = "type=response&recording_id=" + str(recording.id)
        upload_params_encoded = urllib.quote_plus(upload_params)

        recordingObjs.append((
            recording,
            media_url_encoded,
            responseObjs,
            lib.expert_url(recording.phrase.id),
            upload_params_encoded,
        ))



    return render(request,'give_response.html',{
        'recordingObjs':recordingObjs,
    })