Look for an app config containing a given object. object_name is the dotted Python path to the object. Return the app config for the inner application in case of nesting. Return None if the object isn't in any registered app config.
(self, object_name)
| 249 | return any(ac.name == app_name for ac in self.app_configs.values()) |
| 250 | |
| 251 | def get_containing_app_config(self, object_name): |
| 252 | """ |
| 253 | Look for an app config containing a given object. |
| 254 | |
| 255 | object_name is the dotted Python path to the object. |
| 256 | |
| 257 | Return the app config for the inner application in case of nesting. |
| 258 | Return None if the object isn't in any registered app config. |
| 259 | """ |
| 260 | self.check_apps_ready() |
| 261 | candidates = [] |
| 262 | for app_config in self.app_configs.values(): |
| 263 | if object_name.startswith(app_config.name): |
| 264 | subpath = object_name.removeprefix(app_config.name) |
| 265 | if subpath == "" or subpath[0] == ".": |
| 266 | candidates.append(app_config) |
| 267 | if candidates: |
| 268 | return sorted(candidates, key=lambda ac: -len(ac.name))[0] |
| 269 | |
| 270 | def get_registered_model(self, app_label, model_name): |
| 271 | """ |