Commit Graph

116 Commits

Author SHA1 Message Date
Marten Kenbeek 40c8ffad72 Fixed #29768 -- Improved error message when an AppConfig has a typo in INSTALLED_APPS. 2018-09-26 16:12:21 -04:00
Sergey Fedoseev 553c24018e Removed unneeded list() calls in list.extend() argument. 2018-09-25 11:30:43 -04:00
Jon Dufresne 8c3e0eb1c1 Normalized spelling of "lowercase" and "lowercased". 2018-09-25 10:30:18 -04:00
Claude Paroz d65b0f72de Fixed #17379 -- Removed management commands deactivation of the locale. 2018-05-13 10:21:53 +02:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Anton Samarchyan 86de930f41 Refs #27656 -- Updated remaining docstring verbs according to PEP 257. 2017-03-04 10:02:06 -05:00
François Freitag fba4f831bc Fixed #27176 -- Raised an exception for reentrant calls to apps.populate().
Thanks to Aymeric Augustin, Harry Percival, and Tim Graham.
2017-02-25 15:56:24 -05:00
Tim Graham 1c466994d9 Refs #23919 -- Removed misc Python 2/3 references. 2017-01-25 13:59:25 -05:00
Tim Graham d170c63351 Refs #23919 -- Removed misc references to Python 2. 2017-01-21 20:02:00 -05:00
Tim Graham 4e729feaa6 Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Aymeric Augustin 3cc5f01d9b Refs #23919 -- Stopped using django.utils.lru_cache(). 2017-01-18 21:42:40 -05:00
Adam Chainz 9d4246419c Refs #26207 -- Removed obsolete comments about deferred model classes. 2016-11-20 18:22:13 -05:00
Ramin Farajpour Cami 967be82443 Fixed E305 flake8 warnings. 2016-11-14 12:30:46 -05:00
Aymeric Augustin 625cd5bcb3 Added require_ready argument to get_model methods.
This allows bringing back the behavior of Django < 1.7.

Also fixed the check for the app registry being ready in
AppConfig.get_model(s), which was inconsistent with the equivalent check in
Apps.get_model(s). That part is a backwards-incompatible change.
2016-10-28 19:08:57 -04:00
Aymeric Augustin fd748c42a9 Simplified AppConfig.import_models().
Since AppConfig now has a reference to its parent Apps registry,
it can look up the models there instead of receiving them in argument.
2016-10-28 18:43:45 -04:00
Aymeric Augustin efcb7e1ebf Modified readiness check in AppConfig.get_model(s).
It was inconsistent with the equivalent check in Apps.get_model(s)
because I made incorrect assumptions when I wrote that code and
needlessly complicated readiness checks.

This is a backwards-incompatible change.
2016-10-28 18:42:29 -04:00
inondle 080dd74e01 Fixed #26616 -- Improved error message when AppConfig.name is invalid. 2016-06-02 10:37:00 -04:00
Alex Hill 2ff7ef15b0 Refs #26421 -- Refactored Apps.lazy_model_operation() for better checks and tests 2016-05-19 21:33:36 -04:00
Anssi Kääriäinen 7f51876f99 Fixed #26207 -- Replaced dynamic classes with non-data descriptors for deferred instance loading. 2016-04-29 13:06:32 -04:00
Tim Graham df8d8d4292 Fixed E128 flake8 warnings in django/. 2016-04-08 09:51:06 -04:00
Tim Graham 7506616f16 Refs #24215 -- Fixed Python 3.5 compatiblity for unhandled lazy ops error. 2015-09-17 10:06:52 -04:00
Caio Ariede 6a98396b9d Fixed #25246 -- Guarded against duplicate paths in AppConfig. 2015-09-02 15:27:41 -04:00
Markus Holtermann e1427cc609 Fixed #24590 -- Cached calls to swappable_setting.
Moved the lookup in Field.swappable_setting to Apps, and added
an lru_cache to cache the results.

Refs #24743

Thanks Marten Kenbeek for the initial work on the patch. Thanks Aymeric
Augustin and Tim Graham for the review.
2015-08-27 17:06:21 +10:00
Marten Kenbeek aabb58428b Refs #23621 -- Fixed warning message when reloading models. 2015-06-30 15:00:10 -04:00
Tim Graham 7da3923ba0 Sorted imports in __init__.py files. 2015-06-27 11:53:33 -04:00
Tim Graham 7f1168e387 Removed support for Python 3.3. 2015-06-18 08:36:50 -04:00
Peter Inglesby 0688a7946a Fixed #24776 -- Improved apps.get_app_config() error message on fully-qualified package names. 2015-05-22 11:08:25 -04:00
Alex Hill 720ff740e7 Fixed #24215 -- Refactored lazy model operations
This adds a new method, Apps.lazy_model_operation(), and a helper function,
lazy_related_operation(), which together supersede add_lazy_relation() and
make lazy model operations the responsibility of the App registry. This
system no longer uses the class_prepared signal.
2015-03-25 16:48:17 -04:00
Marten Kenbeek 888c9b6429 Fixed #24397 -- Sped up rendering multiple model states.
Set apps.ready to False when rendering multiple models. This prevents
that the cache on Model._meta is expired on all models after each time a
single model is rendered. Prevented that Apps.clear_cache() refills the
cache on Apps.get_models(), so that the wrong value cannot be cached
when cloning a StateApps.
2015-03-08 13:54:49 +01:00
Tim Graham 9033003d97 Added check_apps_ready() to Apps.get_containing_app_config() 2015-02-08 14:52:19 -05:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham cf5b67d3a0 Removed deprecated Apps methods per deprecation timeline. 2015-01-18 18:07:41 -05:00
Tim Graham bd98926f0e Removed an obsolete comment in django/apps/config.py 2015-01-18 16:30:45 -05:00
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Loic Bistuer b62f72498a Improved warning message when reloading models. Refs #23621.
Thanks dfunckt and Tim Graham.
2014-10-23 01:46:04 +07:00
Loic Bistuer 8c4ca16c65 Fixed #23621 -- Warn for duplicate models when a module is reloaded.
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-23 00:55:02 +07:00
Tim Graham 8121860be4 Revert "Improved AppRegistryNotReady message."
This reverts commit 6fa9fa91a5.

Aymeric: "I chose not to talk about django.setup() here on purpose.
This will hardly always be the correct solution."
2014-10-04 13:13:54 -04:00
Collin Anderson 6fa9fa91a5 Improved AppRegistryNotReady message. 2014-10-04 08:02:22 -04:00
Aymeric Augustin b161c01c48 Fixed #22920 -- Avoid masking some exceptions.
If loading an application trigger an ImportError, the details of that
error were lost in some cases. Thanks Ben Davis for the report.
2014-09-08 23:16:50 +02:00
Aymeric Augustin a764a9ccff Checked more precisely whether the app registry is ready.
Accounted for the three stages of population: app configs, models,
ready() methods of app configs.
2014-07-12 18:49:37 +02:00
Claude Paroz 9618d68b34 Fixed #8033 -- Explained app registry error during translation setup
Thanks Tim Graham and Aymeric Augustin for the review.
2014-06-23 09:31:45 +02:00
Claude Paroz 210d0489c5 Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00
Rodolfo Carvalho 4d4e0ea461 Fixed two typos. 2014-02-15 15:16:16 +01:00
Carl Meyer 88a2d39159 Fixed #21874 -- Require Django applications to have a filesystem path.
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-27 15:34:22 -07:00
Simon Charette c3881944e8 Fixed some missing/extraneous new line warnings. 2014-01-26 14:32:01 -05:00
Aymeric Augustin 4f03b718f7 Fixed #21877 -- Renamed django.apps.base to config. 2014-01-26 13:17:03 +01:00
Aymeric Augustin 3c47786cb9 Fixed #21702 -- get_model('app_label.ModelName').
Also added tests for get_model.
2014-01-26 13:01:09 +01:00
Carl Meyer 966b186981 Fixed #17304 -- Allow single-path and configured-path namespace packages as 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-25 19:37:05 -07:00
Aymeric Augustin 2ff93e027c Fixed #21829 -- Added default AppConfigs.
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-25 10:41:56 +01:00