예제 #1
0
파일: views.py 프로젝트: anoncb1754/DocDIA
def transcript_project(request):
    project_id = request.GET.get('project')
    page_id = int(request.GET.get('index'))

    project = Project.objects.get(id=project_id)
    pages = []
    pages += Page.objects.filter(project=project_id)
    print 'THe pages are', pages

    pages_length = pages.__len__()

    #display_page = Page.objects.get(id=page_id)
    display_page = pages[setNavImages(page_id, pages_length)]
    print 'DISPLAY PAGE', display_page

    #nav_pages = getNavPages(pages)

    #Use indexes of array

    next_page = setNavImages(page_id + 1, pages_length)
    prev_page = setNavImages(page_id - 1, pages_length)
    print 'THE DISPLAY PAGE', display_page

    if request.method == 'POST':
        form = TranscriptrForm(request.POST)
        if form.is_valid():
            content = request.POST.get('content')
            #Get the project id
            project_id = request.GET.get('project')
            #Get the page of the Project
            page = pages[page_id]  #Page.objects.get(id=page_id)
            print 'The page is', page
            transcription = Transcription(content=content,
                                          date_created=datetime.now(),
                                          page=page)
            print 'The transcription:', transcription
            transcription.save()
            print 'TRANSCRIPTION IS:', transcription
            return HttpResponseRedirect("/accounts/profile/")
    else:
        form = TranscriptrForm()
    return render_to_response(
        "accounts/profile/transcript.html", {
            'form': form,
            'pages': pages,
            'display_page': display_page,
            'project': project,
            'pages': pages,
            'next_page': next_page,
            'prev_page': prev_page
        })
예제 #2
0
파일: views.py 프로젝트: anoncb1754/DocDIA
def docViewer(request):
    if request.method == 'POST':
        form = TranscriptrForm(request.POST)
        if form.is_valid():
            #Here comes the stuff to save the content to the db
            ct = request.POST.get('content')
            dt = datetime.now()
            tr = Transcriptions(content=ct, date_created=dt)
            tr.save()
            print 'Saved transcription to database!'
            return HttpResponseRedirect('/docViewer/confirmation/')
    else:
        form = TranscriptrForm()

    return render_to_response('docviewer.html', {'form': form})
예제 #3
0
파일: views.py 프로젝트: anoncb1754/DocDIA
def docViewer(request):
	if request.method == 'POST':
		form = TranscriptrForm(request.POST)
		if form.is_valid():
			#Here comes the stuff to save the content to the db
			ct = request.POST.get('content')
			dt = datetime.now()
			tr = Transcriptions(content = ct, date_created=dt)
			tr.save()
			print 'Saved transcription to database!'
			return HttpResponseRedirect('/docViewer/confirmation/')
	else:
		form = TranscriptrForm()


	return render_to_response('docviewer.html', {'form': form})
예제 #4
0
파일: views.py 프로젝트: anoncb1754/DocDIA
def transcript_project(request):
    project_id = request.GET.get('project')
    page_id = int(request.GET.get('index'))
    
    project = Project.objects.get(id=project_id)
    pages = []
    pages += Page.objects.filter(project=project_id)
    print 'THe pages are', pages
    
    pages_length = pages.__len__()

    #display_page = Page.objects.get(id=page_id)
    display_page = pages[setNavImages(page_id, pages_length)]
    print 'DISPLAY PAGE', display_page

    #nav_pages = getNavPages(pages)

    #Use indexes of array 

    next_page = setNavImages(page_id + 1, pages_length)
    prev_page = setNavImages(page_id - 1, pages_length)
    print 'THE DISPLAY PAGE', display_page

    if request.method == 'POST':
        form = TranscriptrForm(request.POST)
        if form.is_valid():
            content = request.POST.get('content')
            #Get the project id
            project_id = request.GET.get('project')
            #Get the page of the Project
            page = pages[page_id]#Page.objects.get(id=page_id)
            print 'The page is', page
            transcription = Transcription(content=content,date_created=datetime.now(),page=page)
            print 'The transcription:', transcription
            transcription.save()
            print 'TRANSCRIPTION IS:', transcription
            return HttpResponseRedirect("/accounts/profile/")
    else:
        form = TranscriptrForm()
    return render_to_response("accounts/profile/transcript.html", 
            {'form': form, 'pages': pages, 'display_page': display_page, 
                'project': project, 'pages': pages, 'next_page': next_page, 'prev_page': prev_page })