예제 #1
0
def continue_basic_coding(request, reset = False):
    """ option in setup_basic_data_download.html """  
    global PageIndex
    if reset:
        civet_form.create_TempData_header()    
    PageIndex = 0
    civet_form.FormFields = deepcopy(InitalFormVals)
    return render(request,'djciv_data/basic_form.html', get_form_context())
예제 #2
0
def read_template_only(request, isdemo = False):
    global PageIndex, InitalFormVals
    """ reads a simple template (not a collection), checks for errors, and then either renders the form or lists the errors.
        if isdemo, reads the demo template """
    if 'codername' in request.POST:
        civet_form.CoderName = request.POST['codername']        
    if isdemo:
        st = open(civet_settings.STATIC_FILE_PATH + civet_settings.DEMO_TEMPLATE,'r')  
    else: 
        if 'template_name' in request.FILES:
#            print('RTO2:',request.FILES['template_name'])        
            st = request.FILES['template_name']
        else:
            return HttpResponse("No file was selected: please go back to the previous page and select a file")

    civet_form.read_template(st)
    if civet_form.FormContent[0].startswith('&Errors:'):
        return render(request,'djciv_data/template_error.html', {'form_content': civet_form.FormContent[0][8:]})
    else:
        civet_form.create_TempData_header()
        PageIndex = 0
        InitalFormVals = deepcopy(civet_form.FormFields)
        return render(request,'djciv_data/basic_form.html', get_form_context())