def srs_step_view(req, upload_session): import_session = upload_session.import_session form = None if req.method == 'POST': form = forms.SRSForm(req.POST) if form.is_valid(): srs = form.cleaned_data['srs'] upload.srs_step(upload_session, srs) return _next_step_response(req, upload_session) task = import_session.tasks[0] # CRS missing/unknown if task.state == 'NO_CRS': native_crs = task.layer.srs form = form or forms.SRSForm() if form: name = task.layer.name return render_to_response('upload/layer_upload_crs.html', RequestContext(req, { 'native_crs': native_crs, 'form': form, 'layer_name': name })) # mark this completed since there is no post-back when skipping upload_session.completed_step = 'srs' return _next_step_response(req, upload_session)
def srs_step_view(req, upload_session): import_session = upload_session.import_session form = None if req.method == 'POST': form = forms.SRSForm(req.POST) if form.is_valid(): srs = form.cleaned_data['srs'] upload.srs_step(upload_session, srs) return _next_step_response(req, upload_session) if import_session.tasks[0].state == 'INCOMPLETE': if req.GET.__contains__('force_ajax') and req.GET['force_ajax']: url = reverse('data_upload') + "?id=%s" % import_session.id return json_response( {'url': url, 'status': 'incomplete', 'success': True, 'redirect_to': '/upload/srs', 'input_required': True, } ) else: # CRS missing/unknown if import_session.tasks[0].items[0].state == 'NO_CRS': native_crs = import_session.tasks[0].items[0].resource.nativeCRS form = form or forms.SRSForm() if form: name = import_session.tasks[0].items[0].layer.name return render_to_response('upload/layer_upload_crs.html', RequestContext(req,{ 'native_crs' : native_crs, 'form' : form, 'layer_name' : name })) # mark this completed since there is no post-back when skipping upload_session.completed_step = 'srs' return _next_step_response(req, upload_session)