command execution

def handle(self, targetdir, app=None, **options):
        """ command execution """
        translation.activate(settings.LANGUAGE_CODE)
        if app:
            unpack = app.split('.')

            if len(unpack) == 2:
                models = [get_model(unpack[0], unpack[1])]
            elif len(unpack) == 1:
                models = get_models(get_app(unpack[0]))
        else:
            models = get_models()
        
        messagemaker = MakeModelMessages(targetdir)
        
        for model in models:
            if hasattr(model, 'localized_fields'):
                for instance in model.objects.all():
                    messagemaker(instance)