(self, args)
return set(models)
Get Models from registry that match the --models args
Get Models from registry that match the --models args
Get Models from registry that match the -- models args
def _get_models(self, args):
        """
        Get Models from registry that match the --models args
        """
        if args:
            models = []
            for arg in args:
                arg = arg.lower()
                match_found = False

                for model in registry.get_models():
                    if model._meta.app_label == arg:
                        models.append(model)
                        match_found = True
                    elif '{}.{}'.format(
                        model._meta.app_label.lower(),
                        model._meta.model_name.lower()
                    ) == arg:
                        models.append(model)
                        match_found = True

                if not match_found:
                    raise CommandError("No model or app named {}".format(arg))
        else:
            models = registry.get_models()

        return set(models)
def _get_models ( self , args ) : if args : models = [ ] for arg in args : arg = arg . lower ( ) match_found = False for model in registry . get_models ( ) : if model . _meta . app_label == arg : models . append ( model ) match_found = True elif '{}.{}' . format ( model . _meta . app_label . lower ( ) , model . _meta . model_name . lower ( ) ) == arg : models . append ( model ) match_found = True if not match_found : raise CommandError ( "No model or app named {}" . format ( arg ) ) else : models = registry . get_models ( ) return set ( models )