@parse_data
@set_database
def get_random_content(kinds=None, limit=1, available=None, **kwargs):
 if (not kinds):
  kinds = ['Video', 'Audio', 'Exercise', 'Document']
 items = Item.select().where(Item.kind.in_(kinds))
 if (available is not None):
  items = items.where((Item.available == available))
 return items.order_by(fn.Random()).limit(limit)

@ parse_data @ set_database def get_random_content ( kinds = None , limit = 1 , available = None , ** kwargs ) : if ( not kinds ) : kinds = [ 'Video' , 'Audio' , 'Exercise' , 'Document' ] items = Item . select ( ) . where ( Item . kind . in_ ( kinds ) ) if ( available is not None ) : items = items . where ( ( Item . available == available ) ) return items . order_by ( fn . Random ( ) ) . limit ( limit )
convenience function for returning random content nodes for use in testing .