summaryrefslogtreecommitdiff
path: root/django
AgeCommit message (Collapse)Author
2013-12-17Added get_app_configs() to iterate on app_config instances.Aymeric Augustin
Refactored get_apps() to rely on that method. This commit is fully backwards-compatible.
2013-12-17Added get_app_config() to look up app configs by label.Aymeric Augustin
Refactored get_app() to rely on that method. get_app() starts by calling _populate(), which goes through INSTALLED_APPS and, for each app, imports the app module and attempts to import the models module. At this point, no further imports are necessary to return the models module for a given app. Therefore, the implementation of get_app() can be simplified and the safeguards for race conditions can be removed. Besides, the emptyOK parameter isn't used anywhere in Django. It was introduced in d6c95e93 but not actually used nor documented, and it has just been carried around since then. Since it's an obscure private API, it's acceptable to stop supporting it without a deprecation path. This branch aims at providing first-class support for applications without a models module eventually. For backwards-compatibility, get_app() still raises ImproperlyConfigured when an app isn't found, even though LookupError is technically more correct. I haven't gone as far as to preserve the exact error messages. I've adjusted a few tests instead.
2013-12-17Fleshed out AppConfig objects.Aymeric Augustin
Marginally improved creation of AppConfig stubs for non-installed apps.
2013-12-17Moved list of models inside AppConfig instances.Aymeric Augustin
This commit is a refactoring with no change of functionality, according to the following invariants: - An app_label that was in app_configs and app_models stays in app_config and has its 'installed' attribute set to True. - An app_label that was in app_models but not in app_configs is added to app_configs and has its 'installed' attribute set to True. As a consequence, all the code that iterated on app_configs is modified to check for the 'installed' attribute. Code that iterated on app_models is rewritten in terms of app_configs. Many tests that stored and restored the state of the app cache were updated. In the long term, we should reconsider the usefulness of allowing importing models from non-installed applications. This doesn't sound particularly useful, can be a trap in some circumstances, and causes significant complexity in sensitive areas of Django.
2013-12-17Removed unused attribute app_errors of the app cache.Aymeric Augustin
get_app_errors() always returned an empty dictionary; this behavior is preserved in django.db.models.loading until that module is deprecated.
2013-12-17Stored AppConfig objects instead of models modules in the app cache.Aymeric Augustin
This is a step towards allowing applications without a models module.
2013-12-17Removed module-level functions for the app cache.Aymeric Augustin
Since the original ones in django.db.models.loading were kept only for backwards compatibility, there's no need to recreate them. However, many internals of Django still relied on them. They were also imported in django.db.models. They never appear in the documentation, except a quick mention of get_models and get_app in the 1.2 release notes to document an edge case in GIS. I don't think that makes them a public API. This commit doesn't change the overall amount of global state but clarifies that it's tied to the app_cache object instead of hiding it behind half a dozen functions.
2013-12-17Removed ModelDict.Aymeric Augustin
Its only difference with OrderedDict is that it didn't deepcopy its keys. However it wasn't used anywhere with models modules as keys, only as values. So this commit doesn't result in any change in functionality.
2013-12-17Removed BaseAppCache.app_store.Aymeric Augustin
It was only storing redundant information. This is part of the effort to allow applications without a models module.
2013-12-17Moved django.db.models.loading to django.apps.cache.Aymeric Augustin
This commit doesn't contain any code changes; it's purely a refactoring.
2013-12-16Removed duplicated `TimeField` in __all__.Artur Barseghyan
2013-12-16Fixed #17413 -- Serialization of form errors along with all metadata.Loic Bistuer
2013-12-16Fixed #21564 -- Use local request object when possible in generic views.Baptiste Mispelon
Thanks to trac user adepue for the report and original patch.
2013-12-16Removed unnecessary function-level import.Baptiste Mispelon
2013-12-16Removed unnecessary call to force_text in utils.html.clean_html.Vajrasky Kok
Refs #21574
2013-12-15Fixed #21619 -- Made SingleObjectMixin.get_object catch a more precise ↵Peter Harley
exception. Thanks to Keryn Knight for the report.
2013-12-15Fixed #21621 -- Removed kqueue autoreloader.Aymeric Augustin
2013-12-14Revert "Allowed running GIS form tests that don't require spatial database"Claude Paroz
This reverts commit 07fe0bf3f4a49a734f83f5ea30130449dacf9660. This was not working properly on system without geos library installed.
2013-12-14Fixed #21250 -- Made HTTP auth user header configurable in testsBartolomé Sánchez
Currently, if the authentication mechanism uses a custom HTTP header and not REMOTE_USER, it is not easy to test. This commit modifies remote user tests in order to make them more generic.
2013-12-14Fixed E127 pep8 warnings.Loic Bistuer
2013-12-14Allowed running GIS form tests that don't require spatial databaseJakub Gocławski
2013-12-14Fixed #21606 -- Fixed default_lat and default_lon override in OSMWidgetJakub Gocławski
2013-12-12Fixed #21574 -- Handle bytes consistently in utils.text.normalize_newlines.Baptiste Mispelon
All input is now coerced to text before being normalized. This changes nothing under Python 2 but it allows bytes to be passed to the function without a TypeError under Python3 (bytes are assumed to be utf-8 encoded text). Thanks to trac user vajrasky for the report.
2013-12-12Fixed PEP257 violations (single-quoted docstrings) in utils.text.Baptiste Mispelon
2013-12-12Fixed #21473 -- Limited language preservation to logoutLudwik Trammer
Current language is no longer saved to session by LocaleMiddleware on every response (the behavior introduced in #14825). Instead language stored in session is reintroduced into new session after logout. Forward port of c558a43fd6 to master.
2013-12-11Brought comments in sync with the code in BaseAppCache.Aymeric Augustin
2013-12-11Fixed #21462 -- Made `assertNumQueries` print executed queries on failure.Dominic Rodger
2013-12-11Fixed #21563 -- Single related object descriptors should work with `hasattr`.Simon Charette
Thanks to Aymeric Augustin for the review and Trac alias monkut for the report.
2013-12-11Fixed #21510 -- Readded search reset link in changelist search barClaude Paroz
Thanks moritz.pfeiffer at alp-phone.ch for the report and Tim Graham for the initial patch.
2013-12-11Fix altering of SERIAL columns and InnoDB being picky about FK changesAndrew Godwin
2013-12-11Better default name for migrations we can't give nice names toAndrew Godwin
2013-12-11Change FKs when what they point to changesAndrew Godwin
2013-12-11Fix sqlmigrate's output for parametersAndrew Godwin
2013-12-10Moved imports to the top of the defaultfilters module.Aymeric Augustin
2013-12-10Fixed E124 pep8 warnings.Loic Bistuer
2013-12-08Merge pull request #2048 from loic/ValidationError.message_dictFlorian Apolloner
Trigger AttributeError in ValidationError.message_dict when error_dict is missing.
2013-12-07Renamed first argument of class method to clsmaurycyp
2013-12-07Fixed #18531 -- Deprecated Geo SitemapsClaude Paroz
I've chosen a quick deprecation path, as Geo Sitemaps themselves are deprecated from some time now.
2013-12-07Fixed #21573 -- Improved performance of utils.text.normalize_newlines.Vajrasky Kok
2013-12-07Trigger AttributeError in ValidationError.message_dict when error_dict is ↵Loic Bistuer
missing. The goal of this change is twofold; firstly, matching the behavior of Django 1.6 and secondly, an AttributeError is more informative than an obscure ValueError about mismatching sequence lengths. Refs #20867.
2013-12-07Removed unneeded string normalization in contrib.adminClaude Paroz
With Python 2.7 and up, named parameter keys are not limited to bytestrings any longer. This mainly reverts 3bd384aa626.
2013-12-07Fixed #21555 -- Made ValidationError pickable.Loic Bistuer
Thanks trac username zanuxzan for the report and original patch.
2013-12-07Fixed #21551 -- Reenabled loading fixtures from subdirectoryClaude Paroz
This was a regression in Django 1.6 that was only partially restored in 839940f27f. Thanks Jonas Haag for the report.
2013-12-07Fixed #21568 -- Added missing ModelMultipleChoiceField to_python methodClaude Paroz
Thanks dibrovsd at gmail.com for the report and Simon Charette for the review.
2013-12-07Fixed #21530 -- Prevent AttributeError in default URLconf detection code.Baptiste Mispelon
Thanks to @dmyerscoug for the report and original patch and to @alasdairnicol for the added tests.
2013-12-06Corrected a flake8 issue -- this line is imported for the purpose of ↵Alex Gaynor
re-exposing the name
2013-12-06Fixed #21566 -- Fixed AttributeError when using bulk_create with ForeignObject.Roger Hu
2013-12-06Fixed #21554 -- Incorrect SQL generated when using multiple inheritance.pegler
2013-12-06Added new 'srtext' spatialite 4.x SpatialRefSys column to its model.Ramiro Morales
This is for general consistency in the GeoDjango DB backends. Thanks Claude for the fix. Refs #19678.
2013-12-06Added missing deconstruct() methods.Baptiste Mispelon