def setup_managers(self):
self._managers = {}<EOL>for manager_class in MODEL_MANAGERS:<EOL><INDENT>instance = manager_class(self)<EOL>if not instance.forbid_registrationand not isinstance(instance, ApplicationManager) or instance.__class__ is ApplicationManager:<EOL><INDENT>setattr(self, instance.name, instance)<EOL><DEDENT>if instance.model:<EOL><INDENT>self._managers[instance.model.__name__] = instance<EOL><DEDENT>if instance.model_aliases:<EOL><INDENT>for alias in instance.model_aliases:<EOL><INDENT>self._managers[alias] = instance<EOL><DEDENT><DEDENT><DEDENT>
Allows to access manager by model name - it is convenient, because HasOffers returns model names in responses.