def _get_direct_filter_query(args):
 query = Q()
 for arg in args:
  if (hasattr(Document, arg) and args[arg]):
   append = Q(**{str((arg + '__id')): long(args[arg])})
   query = (query & append)
 return query

def _get_direct_filter_query ( args ) : query = Q ( ) for arg in args : if ( hasattr ( Document , arg ) and args [ arg ] ) : append = Q ( ** { str ( ( arg + '__id' ) ) : long ( args [ arg ] ) } ) query = ( query & append ) return query
creates a query to filter documents .