Hi folks,
I’m working on a new feature for the auto-importing shell. The main goals we have achieved so far are:
- Building a namespace that maps every name to its model, and using that namespace as the shell namespace.
- Avoiding collisions by giving precedence to the apps listed first in
INSTALLED_APPS
. - Providing access to models that have name collisions by importing all modules’ models with the label
<app_label>_models
. For example, if you want to access an overridden model from theauth
app, you can still access that model using theauth_models
module.
Currently, there is an ongoing discussion about the SHELL_IMPORTS setting. Following the proposal by @DevilsAutumn in this post, the idea is to add this new setting. This would allow advanced users to perform manipulations or preprocess data by overriding the command, and it would simplify customization for beginner users so that they don’t have to subclass the command and override a method.
I would love to hear your feedback about this setting!