Commit Graph

3206 Commits

Author SHA1 Message Date
Florian Apolloner 7d0a519032 Revert "Fixed #21227 -- Added workaround for selenium test failures"
This reverts commit 08c9ab5a0f.
2014-01-03 00:44:49 +01:00
Florian Apolloner b1a399b864 Removed unneeded import. 2014-01-03 00:42:03 +01:00
Florian Apolloner ed2828f0a0 Fixed a few flaky selenium tests.
Many thanks go to David Burns (@AutomatedTester) for helping me understand
css selectors and pointing me towards the correct selenium methods.
2014-01-03 00:36:50 +01:00
Alex Gaynor 791142e8b3 Several small whitespace fixes for styleguide/flake8 violations 2014-01-01 09:37:52 -08:00
Claude Paroz fbbe7ca30c Readded field unadvertantly removed in fedfd5030 2014-01-01 12:07:43 +01:00
Aymeric Augustin 6edd5b0793 Fixed a few issues in previous commit. 2014-01-01 11:52:56 +01:00
Aymeric Augustin fecfd50300 Properly assigned app_label to GIS test models.
Used abstract inheritance to cut down on code repetition.
2014-01-01 11:01:46 +01:00
Loic Bistuer 4befb3015c Fixed #21581 -- Fixed a number of issues with collectstatic.
When STATIC_ROOT wasn't set, collectstatic --clear would delete
every files within the current directory and its descendants.

This patch makes the following changes:

Prevent collectstatic from running if STATIC_ROOT isn't set.

Fixed an issue that prevented collectstatic from displaying the
destination directory.

Changed the warning header to notify when the command is run
in dry-run mode.
2013-12-31 14:58:49 -05:00
Claude Paroz d0eeddd6fc Fixed #21716 -- Only passed arguments supported by ogrinspect
Thanks Marco Badan for the report.
2013-12-31 16:26:44 +01:00
Thomas Schreiber 7b119c1c77 only attempt to create the postgis extension when it does not already exist 2013-12-31 11:34:03 +01:00
Aymeric Augustin bfcc686d22 Removed the only_with_models_module argument of get_model[s].
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-30 23:59:34 +01:00
Aymeric Augustin 80d74097b4 Stopped populating the app registry as a side effect.
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-30 22:11:17 +01:00
Aymeric Augustin e5bcd1d455 Changed get_validation_errors to use an app config. 2013-12-29 21:48:58 +01:00
Aymeric Augustin 21f22f9544 Added Apps.clear_cache().
This avoid leaking implementation details to tests that swap models.
2013-12-29 20:43:10 +01:00
Aymeric Augustin 82aadbb5d5 Fixed a typo.
Thanks Simon.
2013-12-29 20:35:58 +01:00
Aymeric Augustin 7b88a96553 Added AppConfig.get_models(). 2013-12-29 20:31:59 +01:00
Aymeric Augustin 20d487c27b Replaced Options.object_name.lower() by Options.model_name.
Thanks Simon for the suggestion.

Also removed inappropriate lowercasing of app labels in migrations.
Unlike model names, they are case sensitive.
2013-12-29 18:48:37 +01:00
Aymeric Augustin 308960b92a Cleared get_models cache when swapping User model.
Thanks Florian for isolating the shortest way to reproduce this issue:

./runtests.py \
    django.contrib.auth.tests.test_context_processors.AuthContextProcessorTests.test_perms_attrs \
    django.contrib.auth.tests.test_auth_backends.ChangedBackendSettingsTest.test_changed_backend_settings \
    django.contrib.auth.tests.test_auth_backends.CustomUserModelBackendAuthenticateTest.test_authenticate \
    django.contrib.auth.tests.test_basic.BasicTestCase.test_createsuperuser_management_command
2013-12-29 18:25:22 +01:00
Aymeric Augustin 00110904ac Refactored the migration signals to use app configs.
De-aliased pre/post_syncdb to pre/post_migrate to increase
backwards-compatibility.
2013-12-29 17:53:42 +01:00
Aymeric Augustin ba7206cd81 Changed get_model to raise an exception on errors.
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-28 20:53:00 +01:00
Aymeric Augustin 81354b82bf Stopped calling apps.get_model with only_installed=False.
ContentTypes are only created for installed applications, and I could
make a case for not returning a model that isn't installed any more.
The check for stale ContentTypes in update_contenttypes doesn't use
model_class.

ModelSignal actually needs get_registered_model since the lookup happens
at import time. I took this opportunity to perform a small refactoring.
2013-12-28 20:42:58 +01:00
Aymeric Augustin 6e3ca6507c Used app_config.verbose_name instead of app_label|capfirst.
An admin view performed the capitalization in the template, unlike all others.

Refs #10436.
2013-12-26 22:58:37 +01:00
Aymeric Augustin ce1bc2c94b Made the AppConfig API marginally more consistent.
Eliminated the app_ prefix that was more confusing than useful.
2013-12-26 19:25:09 +01:00
Aymeric Augustin 8f04f53dd8 Removed a few gratuitous lambdas. 2013-12-26 14:03:50 +01:00
Tim Graham 4e7aa573ec Added missing newline in previous commit. 2013-12-26 07:52:31 -05:00
Jon Lønne 398642fd9b Fixed #21627 -- Added unicode_literals to changepassword command.
Fixed a crash when executing changepassword command when the user object
representation contained non-ASCII characters.
2013-12-26 07:35:50 -05:00
Alex Gaynor dbe2fb632d Added a missing import and removed an unneeded import 2013-12-24 08:35:13 -08:00
Claude Paroz 9267fb88ef Added more spatial predicates for prepared geometries
GEOS 3.3 added crosses, disjoint, overlaps, touches and within
predicates on prepared geometries.
2013-12-24 16:53:09 +01:00
Claude Paroz d17404aa90 Dropped support for GEOS < 3.1 2013-12-24 15:57:13 +01:00
Claude Paroz 542198c1d0 Fixed #21662 -- Kept parent reference in prepared geometry
Thanks Robert Scott for the report.
2013-12-24 15:25:48 +01:00
Aymeric Augustin 1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Aymeric Augustin e32095616c Imported override_settings from its new location. 2013-12-23 21:37:56 +01:00
Aymeric Augustin da16bb30ff Dropped AppCache._empty, _with_app and _without_app.
It's now easier to achieve the same effect with modify_settings or
override_settings.
2013-12-23 21:37:56 +01:00
Aymeric Augustin 5891990b6e Refactored INSTALLED_APPS overrides.
* Introduced [un]set_installed_apps to handle changes to the
  INSTALLED_APPS setting.
* Refactored [un]set_available_apps to share its implementation
  with [un]set_installed_apps.
* Implemented a receiver to clear some app-related caches.
* Removed test_missing_app as it is basically impossible to reproduce
  this situation with public methods of the new app cache.
2013-12-23 20:15:08 +01:00
Claude Paroz 8cff95e937 Used a more translator-friendly format in admin sites.py 2013-12-23 09:44:16 +01:00
Aymeric Augustin ba60fcbcf7 Used application verbose names in the admin. 2013-12-22 16:53:57 +01:00
Aymeric Augustin 2fef9e5375 Moved apps back in the toplevel django namespace.
Reverted 4a56a93cc4.
2013-12-22 11:39:55 +01:00
Aymeric Augustin 2239081ff1 Expurged INSTALLED_APPS from code and tests.
Except the app cache code and a few specific tests, of course.
2013-12-22 11:39:18 +01:00
Aymeric Augustin 9cdf1f6d54 Stop testing for inclusion in INSTALLED_APPS.
Removed some exception masking in the comments app that was harmful and
couldn't be preserved easily.
2013-12-22 11:39:18 +01:00
Aymeric Augustin 65cd74be8e Stopped iterating on INSTALLED_APPS.
Used the app cache's get_app_configs() method instead.
2013-12-22 11:39:18 +01:00
Aymeric Augustin 86804ab063 Terminated AppCache._populate() with extreme prejudice.
It was called _populate() before I renamed it to populate(). Since it
has been superseded by populate_models() there's no reason to keep it.

Removed the can_postpone argument of load_app() as it was only used by
populate(). It's a private API and there's no replacement. Simplified
load_app() accordingly. Then new version behaves exactly like the old
one even though it's much shorter.
2013-12-22 11:39:17 +01:00
Aymeric Augustin 9b3389b726 Removed the app_config.installed flag.
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.
2013-12-22 11:39:17 +01:00
Aymeric Augustin b80a8357d6 Revert "Changed admin/templates/admin/index.html to make <caption> translatable"
This reverts commit a25fe3b65e.

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
2013-12-20 15:19:03 +01:00
Bouke Haarsma a39d672ec7 Fixed #21386 -- Removed admindocs dependence on sites framework
* 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.
2013-12-18 19:44:04 +01:00
Aymeric Augustin 7eea9bf303 Normalized Model._meta.installed.
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.
2013-12-17 21:55:16 +01:00
Aymeric Augustin 6e895f9e06 Removed superfluous models.py files.
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.
2013-12-17 11:16:48 +01:00
Aymeric Augustin 4a56a93cc4 Moved the new app cache inside core. 2013-12-17 10:17:46 +01:00
Aymeric Augustin 5ba743e262 Made it possible to create apps without a models module.
This commit reverts f44c4a5d0f and 39bbd165.

django.test.simple will be updated in a separate commit as it requires
invasive changes.
2013-12-17 10:17:45 +01:00
Aymeric Augustin 69039becde Deprecated get_app(). 2013-12-17 10:17:45 +01:00
Aymeric Augustin 2732edc5f2 Deprecated get_apps(). 2013-12-17 10:17:45 +01:00