On Sat, Feb 5, 2022 at 7:39 AM Christian González <christian.gonza...@nerdocs.at> wrote: > Disclaimer: Yes, I know that I am somehow polluting the AppConfig namespace > with attrs and methods that could clash with the ones you will add in far > future... Pretix does that too, and honestly, there is hardly a good method, > except creating that methods in another model and using AppConfigs only as > proxy with a pointer to that model...
I think this kind of gets at the core of the issue -- the namespace -- but not quite the right one, since the real issue is what you've put into the module-level namespace of your apps.py, not the attributes you're setting on your AppConfig. So, Django *could* do some trickery to try to figure out how many AppConfig subclasses in the module-level namespace were actually defined in that specific 'apps' module, and decide that if there's only one then that's the default, ignoring any that happen to be there as a result of imports from other modules. But then someone would write an email to this list saying that their workflow involves a single AppConfig class that defines all the things they want, and is just imported into apps.py, and why is Django no longer respecting that? After all, it's an AppConfig subclass and it's in the namespace of their apps.py, and there are no others visible there, and Django's documentation clearly states that they shouldn't have to do anything else! So there's not really a "works for absolutely every use case" solution here. Personally, I think that Django currently is doing the best thing it can (given that there is no perfect thing available to do), and that probably Django's behavior should not change. This means that for your specific case you'll need to set default=True on the AppConfig you want Django to use, but the documentation already was telling you that :) -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAL13Cg8_rbQZOmtCBe%3DroNjWZYDyWE79Oc5fhcoYntrT-Pan2A%40mail.gmail.com.