Commit Graph

63 Commits

Author SHA1 Message Date
Hasan Ramezani 8b2a30f6f1 Fixed #32285 -- Raised ImproperlyConfigured when AppConfig.label is not a valid Python identifier. 2020-12-22 13:26:30 +01:00
Tom Forbes b5e12d490a Fixed #31007 -- Allowed specifying type of auto-created primary keys.
This also changes the default type of auto-created primary keys
for new apps and projects to BigAutoField.
2020-12-15 11:25:46 +01:00
Mariusz Felisiak 287e36bd22
Refs #31180 -- Fixed unreachable assertions in apps tests. 2020-08-11 10:31:09 +02:00
Iuri de Silvio ebd78a9f97
Fixed #31870 -- Fixed crash when populating app registry with empty or without apps module.
Regression in 3f2821af6b.
2020-08-10 20:16:45 +02:00
Aymeric Augustin 3f2821af6b
Fixed #31180 -- Configured applications automatically. 2020-07-21 10:35:12 +02:00
Tom Forbes c8720e7696 Fixed #27685 -- Added watchman support to the autoreloader.
Removed support for pyinotify (refs #9722).
2019-01-13 20:33:47 -05:00
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
Mads Jensen 1500573620 Added test for Apps.get_models() when models_ready=False. 2018-01-30 10:44:58 -05:00
Mads Jensen a51c4de194 Used assertRaisesMessage() to test Django's error messages. 2017-07-29 19:07:23 -04:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Tim Graham 6b4f018b2b Replaced type-specific assertions with assertEqual().
Python docs say, "it's usually not necessary to invoke these methods directly."
2017-03-17 07:51:48 -04:00
Anton Samarchyan 110f4bb6a2 Tested AppConfig.__repr__(). 2017-01-27 09:55:08 -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 9695b14982 Refs #23919 -- Removed str() conversion of type and method __name__. 2017-01-19 11:31:07 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Claude Paroz c716fe8782 Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
2017-01-18 16:21:28 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
inondle 080dd74e01 Fixed #26616 -- Improved error message when AppConfig.name is invalid. 2016-06-02 10:37:00 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Hasan 26ad01719d Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate. 2016-01-29 13:37:33 -05:00
pp b34ff66e5b Added missing period to "etc.". 2016-01-11 18:05:15 -05:00
Simon Charette a08fda2111 Fixed #25746 -- Isolated inlined test models registration.
Thanks to Tim for the review.
2016-01-06 20:00:07 -05:00
Simon Charette 1c5f4e86bc Fixed #25745 -- Promoted RuntimeWarnings to errors in the test suite. 2015-11-14 11:33:28 -05:00
Tim Graham 3af9b70028 Refs #22789 -- Removed contrib.webdesign per deprecation timeline. 2015-09-23 19:31:09 -04:00
Caio Ariede 6a98396b9d Fixed #25246 -- Guarded against duplicate paths in AppConfig. 2015-09-02 15:27:41 -04:00
Maxime Lorant 5153a3bfdc Fixed #25331 -- Removed trailing blank lines in docstrings. 2015-08-31 17:37:21 -04:00
Marten Kenbeek aabb58428b Refs #23621 -- Fixed warning message when reloading models. 2015-06-30 15:00:10 -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
Simon Charette be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -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
Tim Graham 307c0f299a Refs #24324 -- Fixed Python 2 test failures when path to Django source contains non-ASCII characters. 2015-02-17 19:03:03 -05: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 c0cc8f69e7 Refactored tests that rely on an ImportError for Python 3.5 compatibility
A change in Python test discovery [1] causes the old packages that raised
an error to be discovered; now we use a common directory that's
ignored during discovery. Refs #23763.

[1] http://bugs.python.org/issue7559
2015-02-03 18:30:46 -05:00
Tim Graham ef9e3c5ed8 Fixed flake8 warning. 2014-10-22 21:21:02 -04: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
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
Tim Graham e0cf030194 Removed unnecessary absolute_imports. 2014-08-25 10:07:14 -04: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 3c47786cb9 Fixed #21702 -- get_model('app_label.ModelName').
Also added tests for get_model.
2014-01-26 13:01:09 +01:00
Carl Meyer ca95f8e435 Moved sys.path-extending decorator to django.test.utils and used throughout test suite.
Thanks Aymeric for the suggestion.
2014-01-25 22:50:40 -07: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
Carl Meyer 29ddae7436 Fixed #21871 -- Fixed Apps.is_installed() for apps with custom label.
Thanks Aymeric for design discussion.
2014-01-24 20:07:14 -07:00
Aymeric Augustin 6a320cc14a Fixed #21718 -- Renamed has_app to is_installed. 2014-01-06 22:48:41 +01:00
Aymeric Augustin 63137a8304 Enforced unicity of app labels.
Fixed #21679.
2013-12-31 18:04:54 +01:00