def generate_js_models(module, models, collection_prefix, model_prefix,<EOL>model_fn, collection_fn, marker, integrate, js_file):<EOL>
options = {<EOL>'<STR_LIT>': model_prefix,<EOL>'<STR_LIT>': collection_prefix,<EOL>'<STR_LIT>': model_fn,<EOL>'<STR_LIT>': collection_fn<EOL>}<EOL>generator = ModelGenerator(module,<EOL>**{o: options[o] for o in options if options[o] is not None})<EOL>models = generator.generate_models(parse_model_arg(models))<EOL>if integrate:<EOL><INDENT>sys.stderr.write("<STR_LIT>")<EOL>if not marker:<EOL><INDENT>marker = hashlib.md5("<STR_LIT>".format(module, models)).hexdigest()<EOL><DEDENT>start = "<STR_LIT>" % marker<EOL>end = "<STR_LIT>" % marker<EOL>return integrate_to_file("<STR_LIT:\n>".join(models), js_file, start, end)<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT:\n>".join(models)<EOL><DEDENT>
Generate models for Backbone Javascript applications.

    :param module: module from which models are imported
    :param models: model name, can be a tuple WineCountry/WineCountries as singular/plural
    :param model_prefix: namespace prefix for models (app.models.)
    :param collection_prefix: namespace prefix for collection (App.collections.)
    :param model_fn: name of model constructor (MyApp.bb.Model)
    :param collection_fn: name of collection constructor (MyApp.bb.Collection)
    :param marker: marker to indicate the auto generated code
    :param integrate: integrate to file
    :param js_file: file to integrate
    :return: generated models or nothing if writing into a file