fixed up export
This commit is contained in:
@@ -224,15 +224,15 @@ def select():
|
||||
session.last_orderby = orderby
|
||||
session.last_query = request.vars.query
|
||||
form = FORM(TABLE(TR(T('Query:'), '', INPUT(_style='width:400px',
|
||||
_name='query', _value=request.vars.query or '',
|
||||
_name='query', _value=request.vars.query or '', _class="form-control",
|
||||
requires=IS_NOT_EMPTY(
|
||||
error_message=T("Cannot be empty")))), TR(T('Update:'),
|
||||
INPUT(_name='update_check', _type='checkbox',
|
||||
value=False), INPUT(_style='width:400px',
|
||||
_name='update_fields', _value=request.vars.update_fields
|
||||
or '')), TR(T('Delete:'), INPUT(_name='delete_check',
|
||||
or '', _class="form-control")), TR(T('Delete:'), INPUT(_name='delete_check',
|
||||
_class='delete', _type='checkbox', value=False), ''),
|
||||
TR('', '', INPUT(_type='submit', _value=T('submit')))),
|
||||
TR('', '', INPUT(_type='submit', _value=T('submit'), _class="btn btn-primary"))),
|
||||
_action=URL(r=request, args=request.args))
|
||||
|
||||
tb = None
|
||||
@@ -274,7 +274,7 @@ def select():
|
||||
formcsv = FORM(str(T('or import from csv file')) + " ",
|
||||
INPUT(_type='file', _name='csvfile'),
|
||||
INPUT(_type='hidden', _value=csv_table, _name='table'),
|
||||
INPUT(_type='submit', _value=T('import')))
|
||||
INPUT(_type='submit', _value=T('import'), _class="btn btn-primary"))
|
||||
else:
|
||||
formcsv = None
|
||||
if formcsv and formcsv.process().accepted:
|
||||
@@ -392,7 +392,7 @@ def ccache():
|
||||
cache.disk.clear()
|
||||
session.flash += T("Disk Cleared")
|
||||
redirect(URL(r=request))
|
||||
|
||||
|
||||
try:
|
||||
from pympler.asizeof import asizeof
|
||||
except ImportError:
|
||||
@@ -588,7 +588,7 @@ def manage():
|
||||
auth.table_permission().group_id.label = T('Role')
|
||||
auth.table_permission().name.label = T('Permission')
|
||||
if table == auth.table_user():
|
||||
linked_tables=[auth.settings.table_membership_name]
|
||||
linked_tables = [auth.settings.table_membership_name]
|
||||
elif table == auth.table_group():
|
||||
orderby = 'role' if not request.args(3) or '.group_id' not in request.args(3) else None
|
||||
elif table == auth.table_permission():
|
||||
@@ -604,13 +604,13 @@ def manage():
|
||||
def hooks():
|
||||
import functools
|
||||
import inspect
|
||||
list_op=['_%s_%s' %(h,m) for h in ['before', 'after'] for m in ['insert','update','delete']]
|
||||
tables=[]
|
||||
with_build_it=False
|
||||
list_op = ['_%s_%s' %(h,m) for h in ['before', 'after'] for m in ['insert','update','delete']]
|
||||
tables = []
|
||||
with_build_it = False
|
||||
for db_str in sorted(databases):
|
||||
db = databases[db_str]
|
||||
for t in db.tables:
|
||||
method_hooks=[]
|
||||
method_hooks = []
|
||||
for op in list_op:
|
||||
functions = []
|
||||
for f in getattr(db[t], op):
|
||||
@@ -630,16 +630,16 @@ def hooks():
|
||||
except:
|
||||
pass
|
||||
if len(functions):
|
||||
method_hooks.append({'name':op, 'functions':functions})
|
||||
method_hooks.append({'name': op, 'functions':functions})
|
||||
if len(method_hooks):
|
||||
tables.append({'name':"%s.%s" % (db_str,t), 'slug': IS_SLUG()("%s.%s" % (db_str,t))[0], 'method_hooks':method_hooks})
|
||||
tables.append({'name': "%s.%s" % (db_str, t), 'slug': IS_SLUG()("%s.%s" % (db_str,t))[0], 'method_hooks':method_hooks})
|
||||
# Render
|
||||
ul_main = UL(_class='nav nav-list')
|
||||
for t in tables:
|
||||
ul_main.append(A(t['name'], _onclick="collapse('a_%s')" % t['slug']))
|
||||
ul_t = UL(_class='nav nav-list', _id="a_%s" % t['slug'], _style='display:none')
|
||||
for op in t['method_hooks']:
|
||||
ul_t.append(LI (op['name']))
|
||||
ul_t.append(LI(op['name']))
|
||||
ul_t.append(UL([LI(A(f['funcname'], _class="editor_filelink", _href=f['url']if 'url' in f else None, **{'_data-lineno':f['lineno']-1})) for f in op['functions']]))
|
||||
ul_main.append(ul_t)
|
||||
return ul_main
|
||||
@@ -652,10 +652,10 @@ def hooks():
|
||||
def d3_graph_model():
|
||||
""" See https://www.facebook.com/web2py/posts/145613995589010 from Bruno Rocha
|
||||
and also the app_admin bg_graph_model function
|
||||
|
||||
|
||||
Create a list of table dicts, called "nodes"
|
||||
"""
|
||||
|
||||
|
||||
nodes = []
|
||||
links = []
|
||||
|
||||
@@ -665,20 +665,20 @@ def d3_graph_model():
|
||||
fields = []
|
||||
for field in db[tablename]:
|
||||
f_type = field.type
|
||||
if not isinstance(f_type,str):
|
||||
if not isinstance(f_type, str):
|
||||
disp = ' '
|
||||
elif f_type == 'string':
|
||||
disp = field.length
|
||||
disp = field.length
|
||||
elif f_type == 'id':
|
||||
disp = "PK"
|
||||
disp = "PK"
|
||||
elif f_type.startswith('reference') or \
|
||||
f_type.startswith('list:reference'):
|
||||
disp = "FK"
|
||||
else:
|
||||
disp = ' '
|
||||
fields.append(dict(name= field.name, type=field.type, disp = disp))
|
||||
fields.append(dict(name=field.name, type=field.type, disp=disp))
|
||||
|
||||
if isinstance(f_type,str) and (
|
||||
if isinstance(f_type, str) and (
|
||||
f_type.startswith('reference') or
|
||||
f_type.startswith('list:reference')):
|
||||
referenced_table = f_type.split()[1].split('.')[0]
|
||||
|
||||
Reference in New Issue
Block a user