populate list:reference, issue 917, thanks Simonm3
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.00.0 (2012-08-05 19:52:16) dev
|
||||
Version 2.00.0 (2012-08-05 21:19:55) dev
|
||||
|
||||
@@ -140,7 +140,7 @@ def populate(table, n, default=True, compute=False):
|
||||
ids[tablename] = [x.id for x in table._db(table._db[field.type[15:]].id>0).select()]
|
||||
n = len(ids[tablename])
|
||||
if n:
|
||||
record[fieldname] = [item[0] for item in random.sample(ids[tablename], random.randint(0,n-1)/2)]
|
||||
record[fieldname] = [item for item in random.sample(ids[tablename], random.randint(0,n-1)/2)]
|
||||
else:
|
||||
record[fieldname] = 0
|
||||
elif field.type=='list:string' and hasattr(field.requires,'options'):
|
||||
|
||||
Reference in New Issue
Block a user