import schemas f = open('browser/templates/main/dummy.pt', 'w') print >> f, "" for schema in schemas.all(): for field in schema.fields: print "title:", field.title print "name:", field.getName() print >> f, ""+field.title+"" for k, v in field.choices.items(): print >> f, "\t", im = k if not k: im = v print >> f, ""+v.encode('utf-8')+"" print >> f, "" f.close()