def field_complex_descriptions(request, source_id): """ Show HTML form to change group descriptive properties together into groups of complex descriptions """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: rp = RootPath() base_url = rp.get_baseurl() ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() if len(ip.fields) > 0: ip.get_field_annotations() ip.jsonify_field_annotations() imnav = ImportNavigation() ip.nav = imnav.set_nav('field-entity-relations', ip.project_uuid, source_id) template = loader.get_template('imports/field-entity-relations.html') context = { 'ip': ip, 'base_url': base_url, 'user': request.user } return HttpResponse(template.render(context, request)) else: redirect = '../../imports/field-types/' + source_id return HttpResponseRedirect(redirect) else: raise Http404
def field_classify(request, source_id): """ Classifies one or more fields with posted data """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: if request.method == 'POST': ip = ImportProfile(source_id) if ip.project_uuid is not False: ifd = ImportFieldDescribe(source_id) if 'field_type' in request.POST and 'field_num' in request.POST: ifd.update_field_type(request.POST['field_type'], request.POST['field_num']) elif 'field_data_type' in request.POST and 'field_num' in request.POST: ifd.update_field_data_type(request.POST['field_data_type'], request.POST['field_num']) ip.get_fields(ifd.field_num_list) json_output = json.dumps(ip.jsonify_fields(), indent=4, ensure_ascii=False) return HttpResponse( json_output, content_type='application/json; charset=utf8') else: raise Http404 else: return HttpResponseForbidden
def field_entity_relations(request, source_id): """ Show HTML form to change relationships for entities to be created / or updated from an import table """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() if len(ip.fields) > 0: ip.get_field_annotations() ip.jsonify_field_annotations() imnav = ImportNavigation() ip.nav = imnav.set_nav('field-entity-relations', ip.project_uuid, source_id) template = loader.get_template( 'imports/field-entity-relations.html') context = RequestContext(request, {'ip': ip}) return HttpResponse(template.render(context)) else: redirect = '../../imports/field-types/' + source_id return HttpResponseRedirect(redirect) else: raise Http404
def finalize(request, source_id): """ Show HTML form to change relationships for entities to be created / or updated from an import table """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: rp = RootPath() base_url = rp.get_baseurl() ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() imnav = ImportNavigation() ip.nav = imnav.set_nav('finalize', ip.project_uuid, source_id) template = loader.get_template('imports/finalize.html') context = { 'ip': ip, 'base_url': base_url, 'user': request.user } return HttpResponse(template.render(context, request)) else: raise Http404
def field_classify(request, source_id): """ Classifies one or more fields with posted data """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: if request.method == 'POST': ip = ImportProfile(source_id) if ip.project_uuid is not False: ifd = ImportFieldDescribe(source_id) ifd.project_uuid = ip.project_uuid if 'field_type' in request.POST and 'field_num' in request.POST: ifd.update_field_type(request.POST['field_type'], request.POST['field_num']) elif 'field_data_type' in request.POST and 'field_num' in request.POST: ifd.update_field_data_type(request.POST['field_data_type'], request.POST['field_num']) elif 'match_all_unclasified' in request.POST: ifd.match_all_unclassified() ip.get_fields(ifd.field_num_list) json_output = json.dumps(ip.jsonify_fields(), indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404 else: return HttpResponseForbidden
def field_entity_relations(request, source_id): """ Show HTML form to change relationships for entities to be created / or updated from an import table """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: rp = RootPath() base_url = rp.get_baseurl() ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() if len(ip.fields) > 0: ip.get_field_annotations() ip.jsonify_field_annotations() imnav = ImportNavigation() ip.nav = imnav.set_nav('field-entity-relations', ip.project_uuid, source_id) template = loader.get_template('imports/field-entity-relations.html') context = RequestContext(request, {'ip': ip, 'base_url': base_url}) return HttpResponse(template.render(context)) else: redirect = '../../imports/field-types/' + source_id return HttpResponseRedirect(redirect) else: raise Http404
def field_complex_descriptions(request, source_id): """ Show HTML form to change group descriptive properties together into groups of complex descriptions """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: rp = RootPath() base_url = rp.get_baseurl() ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() if len(ip.fields) > 0: ip.get_field_annotations() ip.jsonify_field_annotations() imnav = ImportNavigation() ip.nav = imnav.set_nav('field-entity-relations', ip.project_uuid, source_id) template = loader.get_template( 'imports/field-entity-relations.html') context = { 'ip': ip, 'base_url': base_url, 'user': request.user } return HttpResponse(template.render(context, request)) else: redirect = '../../imports/field-types/' + source_id return HttpResponseRedirect(redirect) else: raise Http404
def field_list(request, source_id): """ Gets list of fields with annotations from source table """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() json_output = json.dumps(ip.jsonify_fields(), indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404
def field_types(request, source_id): """ Show HTML form listing fields classified by field type """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() imnav = ImportNavigation() ip.nav = imnav.set_nav('field-types', ip.project_uuid, source_id) template = loader.get_template('imports/field-types.html') context = RequestContext(request, {'ip': ip}) return HttpResponse(template.render(context)) else: raise Http404
def finalize(request, source_id): """ Show HTML form to change relationships for entities to be created / or updated from an import table """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() imnav = ImportNavigation() ip.nav = imnav.set_nav('finalize', ip.project_uuid, source_id) template = loader.get_template('imports/finalize.html') context = RequestContext(request, {'ip': ip}) return HttpResponse(template.render(context)) else: raise Http404
def field_descriptions(request, source_id): """ Show HTML form to change relationships for entities to be created / or updated from an import table """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() imnav = ImportNavigation() ip.nav = imnav.set_nav('field-descriptions', ip.project_uuid, source_id) template = loader.get_template('imports/field-descriptions.html') context = RequestContext(request, {'ip': ip}) return HttpResponse(template.render(context)) else: raise Http404
def field_descriptions(request, source_id): """ Show HTML form to change relationships for entities to be created / or updated from an import table """ if not request.user.is_superuser: return HttpResponse('Unauthorized', status=401) else: rp = RootPath() base_url = rp.get_baseurl() ip = ImportProfile(source_id) if ip.project_uuid is not False: ip.get_fields() imnav = ImportNavigation() ip.nav = imnav.set_nav('field-descriptions', ip.project_uuid, source_id) template = loader.get_template('imports/field-descriptions.html') context = {'ip': ip, 'base_url': base_url, 'user': request.user} return HttpResponse(template.render(context, request)) else: raise Http404