From e99b4e5aa3c93a9a4480f97617ec229a032db4f8 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 5 Aug 2012 21:19:57 -0500 Subject: [PATCH] populate list:reference, issue 917, thanks Simonm3 --- VERSION | 2 +- gluon/contrib/populate.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 9ac82f3d..e1103116 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-08-05 19:52:16) dev +Version 2.00.0 (2012-08-05 21:19:55) dev diff --git a/gluon/contrib/populate.py b/gluon/contrib/populate.py index 7e93c3f0..813753c2 100644 --- a/gluon/contrib/populate.py +++ b/gluon/contrib/populate.py @@ -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'):