I have trying to display random question for every login (Means client get
different questions for every login).
Here I gave my db.py and def doing paper. Please help me to solve the
problem.
db.define_table('ins_ques',
Field('qnum','integer',notnull=True,readable=False,writable=False,label='Q
Hi Sai,
Can you try this:
import random
## first option to select question
s = number of lines of your table
i = random.randint(0,s)
## second option to select question - best: no broke if delete any record
on table
s = db(db.ins_ques.id > 0).select(db.ins_ques.id)
i = random.sample(s,1)
## h
perhaps you can use random
ref:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#orderby--groupby--limitby--distinct--having-orderby_on_limitby-left-cache
https://groups.google.com/forum/#!topic/web2py/-Y2JL2cIQEI
best regards,
stifan
On Thursday, August 6, 2015 at 4:1
3 matches
Mail list logo