예제 #1
0
파일: views.py 프로젝트: alexrpagan/doit
def detail_shared(req, dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    shared = []
    matches = db.field_candidates(fid)
    shared_value = False
    for match in matches[:4]:
        shared.append({
            'name': match['name'],
            'values': db.sharedvalues(fid, match['id'])
        })
    table = [[]]
    for match in shared:
        table[0].append(match['name'])
    for i in range(0, 10):
        table.append([])
        for match in shared:
            try:
                table[i + 1].append(match['values'][i])
                if match['values'][i] is not None:
                    shared_value = True
            except IndexError:
                table[i + 1].append(' ')
    return render(
        req, 'doit/pop_shared.html', {
            'shared': table,
            'attr_name': attr_name,
            'fid': fid,
            'db': dbname,
            'at_least_one': shared_value,
        })
예제 #2
0
파일: views.py 프로젝트: alexrpagan/doit
def detail_examples(req, dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    egs = [{'name': attr_name, 'values': db.fieldexamples(fid, 10)}]
    matches = db.field_candidates(fid)[:5]
    for match in matches:
        egs.append({
            'name': match['name'],
            'values': db.globalfieldexamples(match['id'], 10)
        })
    transpose = [[]]
    for eg in egs:
        transpose[0].append(eg['name'])
    for i in range(0, 10):
        transpose.append([])
        for eg in egs:
            try:
                transpose[i + 1].append(eg['values'][i])
            except IndexError:
                transpose[i + 1].append(' ')
    return render(req, 'doit/pop_egs.html', {
        'examples': transpose,
        'attr_name': attr_name,
        'fid': fid,
        'db': dbname
    })
예제 #3
0
파일: views.py 프로젝트: alexrpagan/doit
def detail_distro(req,  dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    vals = db.fieldexamples(fid, 1000, distinct=False)
    histos = [bucketize(vals)]
    histos[0]['name'] = attr_name
    matches = db.field_candidates(fid)[:4]
    for match in matches:
        histo = bucketize(db.globalfieldexamples(int(match['id']), n=1000, distinct=False))
        histo['name'] = match['name']
        histos.append(histo)
    return render(req, 'doit/pop_distro.html', {
            'histos': histos, 'attr_name': attr_name, 'fid': fid,
            'db': dbname, })
예제 #4
0
def detail_distro(req,  dbname, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	vals = db.fieldexamples(fid, 1000, distinct=False)
	histos = [bucketize(vals)]
	histos[0]['name'] = attr_name
	matches = db.field_candidates(fid)[:4]
	for match in matches:
		histo = bucketize(db.globalfieldexamples(int(match['id']), n=1000, distinct=False))
		histo['name'] = match['name']
		histos.append(histo)
	return render_to_response('doit/pop_distro.html', {
            'histos': histos, 'attr_name': attr_name, 'fid': fid,
            'db': dbname,})
예제 #5
0
파일: views.py 프로젝트: alexrpagan/doit
def detail_examples(req, dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    egs = [{'name': attr_name, 'values': db.fieldexamples(fid, 10)}]
    matches = db.field_candidates(fid)[:5]
    for match in matches:
        egs.append({'name': match['name'],
                            'values': db.globalfieldexamples(match['id'], 10)})
    transpose = [[]]
    for eg in egs:
        transpose[0].append(eg['name'])
    for i in range(0, 10):
        transpose.append([])
        for eg in egs:
            try:
                transpose[i + 1].append(eg['values'][i])
            except IndexError:
                transpose[i + 1].append(' ')
    return render(req, 'doit/pop_egs.html', {
            'examples': transpose, 'attr_name': attr_name, 'fid': fid,
            'db': dbname})
예제 #6
0
파일: views.py 프로젝트: RoyFangQi/doit
def detail_shared(req, dbname, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	shared = []
	matches = db.field_candidates(fid)
	for match in matches[:4]:
	    shared.append({'name': match['name'],
                           'values': db.sharedvalues(fid, match['id'])})
	table = [[]]
	for match in shared:
	    table[0].append(match['name'])
	for i in range(0, 10):
	    table.append([])
	    for match in shared:
	        try:
		    table[i+1].append(match['values'][i])
		except IndexError:
		    table[i+1].append(' ')
	return render_to_response('doit/pop_shared.html', {
            'shared': table, 'attr_name': attr_name, 'fid': fid,
            'db': dbname,})
예제 #7
0
파일: views.py 프로젝트: alexrpagan/doit
def field_candidates(req, fid, dbname):
    db = DoitDB(dbname)
    return render(req, 'doit/candidate_list.html', {
        'fid': fid, 'candidates': db.field_candidates(fid)})
예제 #8
0
파일: views.py 프로젝트: alexrpagan/doit
def field_candidates(req, fid, dbname):
    db = DoitDB(dbname)
    return render(req, 'doit/candidate_list.html', {
        'fid': fid,
        'candidates': db.field_candidates(fid)
    })