Ejemplo n.º 1
0
def upload(request):
	# Handle file upload
	
	passwordMaster = "prints"
	
	if request.method == 'POST':
		form = DocumentForm(request.POST, request.FILES)
		info = infoForm(request.POST, request.FILES)
		if form.is_valid() and info.is_valid():
			
			newInfo = Info()
			newInfo.password = request.POST.get('password')
			print(newInfo.password)
			if(passwordMaster == newInfo.password):
				
				print("Passed")
				newdoc = Document(docfile = request.FILES['docfile'])
			
			
				newdoc.save()
			
			
				newInfo.ownerName = request.POST['ownerName']
				newInfo.schoolName = request.POST.get('schoolName')
				newInfo.datum = request.FILES['docfile']
			
				newInfo.save()
				
				# Redirect to the document list after POST
				return HttpResponseRedirect(reverse('muck.maker.views.home'))
			else:
				print("Failed")
				form = DocumentForm()
				info = infoForm()
	else:
		form = DocumentForm() # A empty, unbound form
		info = infoForm()

							
	# Load documents for the list page
	documents = Document.objects.all()
	infos = Info.objects.all()
								# Render list page with the documents and the form
	return render_to_response(
		'maker/upload.html',
							  {'documents': documents, 'form': form, 'infos': infos, 'info': info},
		context_instance=RequestContext(request)
	)
Ejemplo n.º 2
0
def upload(request):
    # Handle file upload

    passwordMaster = "prints"

    if request.method == 'POST':
        form = DocumentForm(request.POST, request.FILES)
        info = infoForm(request.POST, request.FILES)
        if form.is_valid() and info.is_valid():

            newInfo = Info()
            newInfo.password = request.POST.get('password')
            print(newInfo.password)
            if (passwordMaster == newInfo.password):

                print("Passed")
                newdoc = Document(docfile=request.FILES['docfile'])

                newdoc.save()

                newInfo.ownerName = request.POST['ownerName']
                newInfo.schoolName = request.POST.get('schoolName')
                newInfo.datum = request.FILES['docfile']

                newInfo.save()

                # Redirect to the document list after POST
                return HttpResponseRedirect(reverse('muck.maker.views.home'))
            else:
                print("Failed")
                form = DocumentForm()
                info = infoForm()
    else:
        form = DocumentForm()  # A empty, unbound form
        info = infoForm()

    # Load documents for the list page
    documents = Document.objects.all()
    infos = Info.objects.all()
    # Render list page with the documents and the form
    return render_to_response('maker/upload.html', {
        'documents': documents,
        'form': form,
        'infos': infos,
        'info': info
    },
                              context_instance=RequestContext(request))
Ejemplo n.º 3
0
def about_staff(request):
	form = DocumentForm() # A empty, unbound form
	info = infoForm()
	documents = Document.objects.all()
	infos = Info.objects.all()
	
	return render_to_response(
							  'maker/about_staff.html',
							  {'documents': documents, 'form': form, 'infos': infos, 'info': info},
							  context_instance=RequestContext(request)
							  )
Ejemplo n.º 4
0
def about_curriculum(request):
    form = DocumentForm()  # A empty, unbound form
    info = infoForm()
    documents = Document.objects.all()
    infos = Info.objects.all()

    return render_to_response('maker/about_curriculum.html', {
        'documents': documents,
        'form': form,
        'infos': infos,
        'info': info
    },
                              context_instance=RequestContext(request))