Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

from django.shortcuts import render_to_response 

from django.template import RequestContext 

from madrona.shapes.forms import UploadForm 

 

 

# TODO convert this to using ModelForm with a custom Django FileField 

# For now we just stick an uploaded shapefile into a project directory 

 

def upload(request): 

    if request.method == 'POST': 

        form = UploadForm(request.POST, request.FILES) 

        if form.is_valid(): 

            form.handle(request.FILES['file_obj']) 

            #form.save() # if a modelform 

            #form.cleaned_data['user'] = request.user 

            return render_to_response('uploaded.html', RequestContext(request,{})) 

    else: 

        form = UploadForm() 

    return render_to_response('upload.html', RequestContext(request,{'form': form}))