summaryrefslogtreecommitdiff
path: root/django/apps
AgeCommit message (Collapse)Author
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2015-01-18Removed deprecated Apps methods per deprecation timeline.Tim Graham
2015-01-18Removed an obsolete comment in django/apps/config.pyTim Graham
2015-01-06Fixed #12663 -- Formalized the Model._meta API for retrieving fields.Daniel Pyrathon
Thanks to Russell Keith-Magee for mentoring this Google Summer of Code 2014 project and everyone else who helped with the patch!
2014-10-23Improved warning message when reloading models. Refs #23621.Loic Bistuer
Thanks dfunckt and Tim Graham.
2014-10-23Fixed #23621 -- Warn for duplicate models when a module is reloaded.Loic Bistuer
Previously a RuntimeError was raised every time two models clashed in the app registry. This prevented reloading a module in a REPL; while it's not recommended to do so, we decided not to forbid this use-case by turning the error into a warning. Thanks @dfunckt and Sergey Pashinin for the initial patches.
2014-10-04Revert "Improved AppRegistryNotReady message."Tim Graham
This reverts commit 6fa9fa91a5fcb228b3c385b35a2018b3821a447a. Aymeric: "I chose not to talk about django.setup() here on purpose. This will hardly always be the correct solution."
2014-10-04Improved AppRegistryNotReady message.Collin Anderson
2014-09-08Fixed #22920 -- Avoid masking some exceptions.Aymeric Augustin
If loading an application trigger an ImportError, the details of that error were lost in some cases. Thanks Ben Davis for the report.
2014-07-12Checked more precisely whether the app registry is ready.Aymeric Augustin
Accounted for the three stages of population: app configs, models, ready() methods of app configs.
2014-06-23Fixed #8033 -- Explained app registry error during translation setupClaude Paroz
Thanks Tim Graham and Aymeric Augustin for the review.
2014-03-08Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warningsClaude Paroz
Thanks Anssi Kääriäinen for the idea and Simon Charette for the review.
2014-02-15Fixed two typos.Rodolfo Carvalho
2014-01-27Fixed #21874 -- Require Django applications to have a filesystem path.Carl Meyer
Wherever possible this filesystem path is derived automatically from the app module's ``__path__`` and ``__file__`` attributes (this avoids any backwards-compatibility problems). AppConfig allows specifying an app's filesystem location explicitly, which overrides all autodetection based on ``__path__`` and ``__file__``. This permits Django to support any type of module as an app (namespace packages, fake modules, modules loaded by other hypothetical non-filesystem module loaders), as long as the app is configured with an explicit filesystem path. Thanks Aymeric for review and discussion.
2014-01-26Fixed some missing/extraneous new line warnings.Simon Charette
2014-01-26Fixed #21877 -- Renamed django.apps.base to config.Aymeric Augustin
2014-01-26Fixed #21702 -- get_model('app_label.ModelName').Aymeric Augustin
Also added tests for get_model.
2014-01-25Fixed #17304 -- Allow single-path and configured-path namespace packages as ↵Carl Meyer
apps. Also document the conditions under which a namespace package may or may not be a Django app, and raise a clearer error message in those cases where it may not be. Thanks Aymeric for review and consultation.
2014-01-25Fixed #21829 -- Added default AppConfigs.Aymeric Augustin
Thanks Russell for the report, Marc for the initial patch, Carl for the final review, and everyone who contributed to the design discussion.
2014-01-24Fixed #21871 -- Fixed Apps.is_installed() for apps with custom label.Carl Meyer
Thanks Aymeric for design discussion.
2014-01-15Fixed typo in comment.Martin Matusiak
2014-01-12Used a regular lock for app registry population.Aymeric Augustin
Since the app registry is always populated before the first request is processed, the situation described in #18251 for the old app cache cannot happen any more. Refs #18251, #21628.
2014-01-06Fixed #21718 -- Renamed has_app to is_installed.Aymeric Augustin
2014-01-05Fixed #21711 -- Enforced unicity of model names.Aymeric Augustin
2013-12-31Renamed AppConfig.setup to ready.Aymeric Augustin
Thanks Jannis and Marc for the feedback. Fixed #21717.
2013-12-31Enforced unicity of app labels.Aymeric Augustin
Fixed #21679.
2013-12-31Made it possible to change an application's label in its configuration.Aymeric Augustin
Fixed #21683.
2013-12-31Checked unicity of app config names when populating the app registry.Aymeric Augustin
This check will miss duplicates until the check for duplicate labels is added. Refs #21679.
2013-12-31Fleshed out release notes for app loading.Aymeric Augustin
Fixed #21715.
2013-12-30Removed the only_with_models_module argument of get_model[s].Aymeric Augustin
Now that the refactorings are complete, it isn't particularly useful any more, nor very well named. Let's keep the API as simple as possible. Fixed #21689.
2013-12-30Merged Apps.populate_apps() and populate_models().Aymeric Augustin
After the recent series of refactorings, there's no reason to keep two distinct methods. Refs #21681.
2013-12-30Removed postponing in Apps.populate_models.Aymeric Augustin
To the best of my understanding, since populate_models() is now called as soon as Django starts, it cannot be called while a models module is being imported, and that removes the need for postponing. (If hell breaks loose we'll revert this commit.) Refs #21681.
2013-12-30Stopped populating the app registry as a side effect.Aymeric Augustin
Since it triggers imports, it shouldn't be done lightly. This commit adds a public API for doing it explicitly, django.setup(), and does it automatically when using manage.py and wsgi.py.
2013-12-30Populated Apps instances immediately by default.Aymeric Augustin
2013-12-30Added AppConfig.setup() to run setup code.Aymeric Augustin
2013-12-30Avoided leaking state on exceptions in populate_models().Aymeric Augustin
2013-12-29Deprecated the app argument of apps.get_models.Aymeric Augustin
Use app_config.get_models() instead.
2013-12-29Fixed stupid error in 21f22f95.Aymeric Augustin
2013-12-29Removed obsolete docstring.Aymeric Augustin
2013-12-29Added Apps.clear_cache().Aymeric Augustin
This avoid leaking implementation details to tests that swap models.
2013-12-29Added AppConfig.get_models().Aymeric Augustin
2013-12-28Removed the only_installed argument of Apps.get_models.Aymeric Augustin
Refs #15903, #15866, #15850.
2013-12-28Changed get_model to raise an exception on errors.Aymeric Augustin
Returning None on errors required unpythonic error checking and was inconsistent with get_app_config. get_model was a private API until the previous commit, but given that it was certainly used in third party software, the change is explained in the release notes. Applied the same change to get_registered_model, which is a new private API introduced during the recent refactoring.
2013-12-28Simplified Apps.get_model and added AppConfig.get_model.Aymeric Augustin
Documented them as public APIs.
2013-12-28Populated non-master app registries.Aymeric Augustin
This removes the gap between the master app registry and ad-hoc app registries created by the migration framework, specifically in terms of behavior of the get_model[s] methods. This commit contains a stealth feature that I'd rather not describe.
2013-12-28Simplified the implementation of register_model.Aymeric Augustin
register_model is called exactly once in the entire Django code base, at the bottom of ModelBase.__new__: new_class._meta.apps.register_model(new_class._meta.app_label, new_class) ModelBase.__new__ exits prematurely 120 lines earlier (sigh) if a model with the same name is already registered: if new_class._meta.apps.get_registered_model(new_class._meta.app_label, name): return (This isn't the exact code, but it's equivalent.) apps.register_model and apps.get_registered_model are essentially a setter and a getter for apps.all_models, and apps.register_model is the only setter. As a consequence, new_class._meta.apps.all_models cannot change in-between. Considering that name == new_class.__name__, we can conclude that register_model(app_label, model) is always called with such arguments that get_registered_model(app_label, model.__name__) returns None. Considering that model._meta.model_name == model.__name__.lower(), and looking at the implementation of register_model and get_registered_model, this proves that self.all_models[app_label] doesn't contain model._meta.model_name in register_model, allowing us to simplify the implementation.
2013-12-27Avoided %r formatting on possibly unicode strings.Aymeric Augustin
The u prefix looks bad on Python 2.
2013-12-26Normalized exceptions raised by AppConfig.create.Aymeric Augustin
It raises ImportError whenever an entry in INSTALLED_APPS points (directly or indirectly via AppConfig.name) to a non-existing module and ImproperlyConfigured in all other cases. Catching ImportError and re-raising ImproperlyConfigured tends to make circular imports more difficult to diagnose.
2013-12-26Made the AppConfig API marginally more consistent.Aymeric Augustin
Eliminated the app_ prefix that was more confusing than useful.
2013-12-26Made unset_installed_apps reset the app registry state.Aymeric Augustin
Previously the _apps/models_loaded flags could remain set to False if set_installed_apps exited with an exception, which is going to happen as soon as we add tests for invalid values of INSTALLED_APPS.