- 22 Ara, 2013 5 kayıt (commit)
-
-
Aymeric Augustin yazdı
First stage imports app modules. It doesn't catch import errors. This matches the previous behavior and keeps the code simple. Second stage import models modules. It catches import errors and retries them after walking through the entire list once. This matches the previous behavior and seems useful. populate_models() is intended to be equivalent to populate(). It isn't wired yet. That is coming in the next commit.
-
Aymeric Augustin yazdı
Since applications that aren't installed no longer have an application configuration, it is now always True in practice. Provided an abstraction to temporarily add or remove applications as several tests messed with app_config.installed to achieve this effect. For now this API is _-prefixed because it looks dangerous.
-
Aymeric Augustin yazdı
It wasn't used anywhere and couldn't be implemented any more since non-installed apps no longer have a configuration.
-
Aymeric Augustin yazdı
Got rid of AppConfig._stub. As a side effect, app_cache.app_configs now only contains entries for applications that are in INSTALLED_APPS, which is a good thing and will allow dramatic simplifications (which I will perform in the next commit). That required adjusting all methods that iterate on app_configs without checking the "installed" flag, hence the large changes in get_model[s]. Introduced AppCache.all_models to store models: - while the app cache is being populated and a suitable app config object to register models isn't available yet; - for applications that aren't in INSTALLED_APPS since they don't have an app config any longer. Replaced get_model(seed_cache=False) by registered_model() which can be kept simple and safe to call at any time, and removed the seed_cache argument to get_model[s]. There's no replacement for that private API. Allowed non-master app caches to go through populate() as it is now safe to do so. They were introduced in 1.7 so backwards compatibility isn't a concern as long as the migrations framework keeps working.
-
Aymeric Augustin yazdı
-
- 21 Ara, 2013 1 kayıt (commit)
-
-
Alexey Voronov yazdı
Thanks Tim Graham for review.
-
- 20 Ara, 2013 4 kayıt (commit)
-
-
Aymeric Augustin yazdı
This reverts commit a25fe3b6. It didn't do anything. It merely added to every PO file: msgid "%(name)s" msgstr "%(name)s" Thanks Ramiro Morales for the report at: https://groups.google.com/d/msg/Django-I18N/vc2vQzv80UQ/EuaW38V7X7sJ Conflicts: django/contrib/admin/templates/admin/index.html
-
Aymeric Augustin yazdı
Refs #19031.
-
Alex Gaynor yazdı
-
Alex Hill yazdı
It's now consistent with RenderContext.get.
-
- 18 Ara, 2013 9 kayıt (commit)
-
-
Tim Graham yazdı
Thanks graeme.perrow at sap.com for the original report.
-
Tim Graham yazdı
Thanks Bruno Brouard for the report.
-
Ondrej Sika yazdı
-
Bouke Haarsma yazdı
* Removed ADMIN_FOR setting and warn warning * Group view functions by namespace instead of site * Added a test verifying namespaces are listed Thanks to Claude Paroz for reviewing and ideas for improvement.
-
Baptiste Mispelon yazdı
Callable arguments were an untested and undocumented feature.
-
Kevin Christopher Henry yazdı
Using callables as query parameters is undocumented and not working, so this changes an example from the ForeignKey.limit_choices_to documentation that uses it.
-
Denis Moskalets yazdı
Thanks Anubhav Joshi for the documentation.
-
Loic Bistuer yazdı
-
Tianyi Wang yazdı
-
- 17 Ara, 2013 21 kayıt (commit)
-
-
Aymeric Augustin yazdı
-
Aymeric Augustin yazdı
-
Aymeric Augustin yazdı
Used the information from the app cache instead of creating a duplicate based on INSTALLED_APPS. Model._meta.installed is no longer writable. It was a rather sketchy way to alter private internals anyway.
-
Aymeric Augustin yazdı
Improved Andrew's hack to create temporary app caches to handle migrations. Now the main app cache has a "master" flag set to True (which is a non-default keyword argument, thus unlikely to be used by mistake). Other app cache instances have "master" set to False. The only sanctioned way to access the app cache is by importing django.core.apps.app_cache. If you were instanciating an app cache and relying on the Borg pattern, you'll have to refactor your code.
-
Aymeric Augustin yazdı
Added comments in the three empty models.py files that are still needed. Adjusted the test runner to add applications corresponding to test labels to INSTALLED_APPS even when they don't have a models module.
-
Aymeric Augustin yazdı
-
Aymeric Augustin yazdı
Thanks Marc Tamlyn for the suggestion.
-
Aymeric Augustin yazdı
-
Aymeric Augustin yazdı
Thanks Florian for catching this mistake.
-
Aymeric Augustin yazdı
-
Aymeric Augustin yazdı
This commit reverts f44c4a5d and 39bbd165. django.test.simple will be updated in a separate commit as it requires invasive changes.
-
Aymeric Augustin yazdı
-
Aymeric Augustin yazdı
-
Aymeric Augustin yazdı
Several parts of Django call get_apps() with a comment along this lines of "this has the side effect of calling _populate()". I fail to see how this is better than just calling populate()!
-
Aymeric Augustin yazdı
Since it's never called with more than one model at a time the current signature is needlessly complicated.
-
Aymeric Augustin yazdı
It feels more natural for self.available_apps to contain app names (like INSTALLED_APPS) than app labels, and this is easy to implement now.
-
Aymeric Augustin yazdı
-
Aymeric Augustin yazdı
Refactored get_apps() to rely on that method. This commit is fully backwards-compatible.
-
Aymeric Augustin yazdı
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.
-
Aymeric Augustin yazdı
Marginally improved creation of AppConfig stubs for non-installed apps.
-
Aymeric Augustin yazdı
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.
-