Package madrona :: Package shapes :: Package views :: Module upload
[hide private]

Source Code for Module madrona.shapes.views.upload

 1  from django.shortcuts import render_to_response 
 2  from django.template import RequestContext 
 3  from madrona.shapes.forms import UploadForm 
 4   
 5   
 6  # TODO convert this to using ModelForm with a custom Django FileField 
 7  # For now we just stick an uploaded shapefile into a project directory 
 8   
9 -def upload(request):
10 if request.method == 'POST': 11 form = UploadForm(request.POST, request.FILES) 12 if form.is_valid(): 13 form.handle(request.FILES['file_obj']) 14 #form.save() # if a modelform 15 #form.cleaned_data['user'] = request.user 16 return render_to_response('uploaded.html', RequestContext(request,{})) 17 else: 18 form = UploadForm() 19 return render_to_response('upload.html', RequestContext(request,{'form': form}))
20