def source_data(req, dbname, sid): db = DoitDB(dbname) data = { 'fields': db.source_fields(sid), 'entities': db.source_entities(sid, 10) } return HttpResponse(simplejson.dumps(data), mimetype='application/json')
def source_table(req, dbname, sid): db = DoitDB(dbname) fields = db.source_fields(sid) entities = db.source_entities(sid, 10) for entity in entities: vals = [] for field in fields: try: vals.append(entity['fields'][field['id']]) except KeyError: vals.append('') if vals[-1] is None: vals[-1] = '' entity['fields'] = vals return render_to_response('doit/viewTable_template.html', { 'fields': fields, 'entities': entities})
def source_data(req, dbname, sid): db = DoitDB(dbname) data = {'fields': db.source_fields(sid), 'entities': db.source_entities(sid, 10)} return HttpResponse(simplejson.dumps(data), mimetype='application/json')