Clone fields, but leave tables untouched in factory()
This commit is contained in:
Tim Nyborg
2017-07-21 10:20:08 +01:00
committed by GitHub
parent 0a013e3edc
commit ec21f72ce3
+9 -2
View File
@@ -1919,8 +1919,15 @@ class SQLFORM(FORM):
if 'table_name' in attributes:
del attributes['table_name']
return SQLFORM(DAL(None).define_table(table_name, *[field.clone() for field in fields]),
**attributes)
fields_with_clones = []
for field in fields:
if isinstance(field, Field):
fields_with_clones.append(field.clone())
else:
# We have a table, so pass it along
fields_with_clones.append(field)
return SQLFORM(DAL(None).define_table(table_name, *fields_with_clones), **attributes)
@staticmethod
def build_query(fields, keywords):