Get a list of models for the given app labels, with some exceptions.
    TODO: If a required model is referenced, it should also be included.
    Or at least discovered with a get_or_create() call.

def get_models(app_labels):
    """
    Get a list of models for the given app labels, with some exceptions.
    TODO: If a required model is referenced, it should also be included.
    Or at least discovered with a get_or_create() call.
    """

    # These models are not to be output, e.g. because they can be generated automatically
    # TODO: This should be "appname.modelname" string
    EXCLUDED_MODELS = (ContentType, )

    models = []

    # If no app labels are given, return all
    if not app_labels:
        for app in apps.get_app_configs():
            models += [m for m in apps.get_app_config(app.label).get_models()
                       if m not in EXCLUDED_MODELS]
        return models

    # Get all relevant apps
    for app_label in app_labels:
        # If a specific model is mentioned, get only that model
        if "." in app_label:
            app_label, model_name = app_label.split(".", 1)
            models.append(apps.get_model(app_label, model_name))
        # Get all models for a given app
        else:
            models += [m for m in apps.get_app_config(app_label).get_models()
                       if m not in EXCLUDED_MODELS]

    return models