summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-12-29Replaced Options.object_name.lower() by Options.model_name.Aymeric Augustin
Thanks Simon for the suggestion. Also removed inappropriate lowercasing of app labels in migrations. Unlike model names, they are case sensitive.
2013-12-29Cleared get_models cache when swapping User model.Aymeric Augustin
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-29Refactored the migration signals to use app configs.Aymeric Augustin
De-aliased pre/post_syncdb to pre/post_migrate to increase backwards-compatibility.
2013-12-29Skipped inclusion of scripts (pip will take care of that).Florian Apolloner
2013-12-28Added generation of SQLite FK DDL in initial migrations.Ramiro Morales
SQLite accepts the relevant standard SQL (although by default it doesn't enforce the constraint), and the 'traditional' creation backend helper generate it, so this allows us to: - Maintain the status quo - Improve readability of the SQL code generated for that backend. Also, we will need this for when we fix Refs #14204.
2013-12-28Fixed #21242 -- Allowed more IANA schemes in URLValidatorClaude Paroz
Thanks Sascha Peilicke for the report and initial patch, and Tim Graham for the review.
2013-12-28Removed the only_installed argument of Apps.get_models.Aymeric Augustin
Refs #15903, #15866, #15850.
2013-12-28Changed get_model to raise an exception on errors.Aymeric Augustin
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-28Simplified Apps.get_model and added AppConfig.get_model.Aymeric Augustin
Documented them as public APIs.
2013-12-28Stopped calling apps.get_model with only_installed=False.Aymeric Augustin
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-28Populated non-master app registries.Aymeric Augustin
This removes the gap between the master app registry and ad-hoc app registries created by the migration framework, specifically in terms of behavior of the get_model[s] methods. This commit contains a stealth feature that I'd rather not describe.
2013-12-28Introduced as_bytes for SafeMIMEText (and other SafeMIME-classes).Florian Apolloner
This is to provide a consistent interface (namely bytes) for the smtp backend which after all sends bytes over the wire; encoding with as_string yields different results since mails as unicode are not really specified. as_string stays for backwardscompatibilty mostly and some debug outputs. But keep in mind that the output doesn't match as_bytes!
2013-12-28Fixed doc indentation in previous commit.Tim Graham
2013-12-28Fixed #20346 -- Made cache middleware vary on the full URL.ijl
Previously, only the URL path was included in the cache key. Thanks jamey for the suggestion.
2013-12-28Worked around a bug in python 3.3.3. Refs #21093Florian Apolloner
2013-12-28Implemented #10164 for new schema migration code.Ramiro Morales
Made it use 'AUTOINCREMENT' suffix for PK creation. This way it doeesn't regress when compared with the 'traditional' DB backend creation infrastructure. Refs #10164.
2013-12-28Fixed #21093 -- Ensured that mails are not base64 encoded on python 3.3.3+.Florian Apolloner
Thanks to Arfrever for the report and Aymeric for the review.
2013-12-28Fixed #21618 -- Added hints about openlayers.js hostingClaude Paroz
Thanks kz26 for the report and Tim Graham for the excellent review.
2013-12-28Used app_label instead of appname.Aymeric Augustin
The last component of the dotted path to the application module is consistently referenced as the application "label". For instance it's AppConfig.label. appname could be confused with AppConfig.name, which is the full dotted path.
2013-12-28Migrated built-in AppCommands to use handle_app_config.Aymeric Augustin
2013-12-28Updated the AppCommand API to support apps without a models module.Aymeric Augustin
2013-12-28Simplified the implementation of register_model.Aymeric Augustin
register_model is called exactly once in the entire Django code base, at the bottom of ModelBase.__new__: new_class._meta.apps.register_model(new_class._meta.app_label, new_class) ModelBase.__new__ exits prematurely 120 lines earlier (sigh) if a model with the same name is already registered: if new_class._meta.apps.get_registered_model(new_class._meta.app_label, name): return (This isn't the exact code, but it's equivalent.) apps.register_model and apps.get_registered_model are essentially a setter and a getter for apps.all_models, and apps.register_model is the only setter. As a consequence, new_class._meta.apps.all_models cannot change in-between. Considering that name == new_class.__name__, we can conclude that register_model(app_label, model) is always called with such arguments that get_registered_model(app_label, model.__name__) returns None. Considering that model._meta.model_name == model.__name__.lower(), and looking at the implementation of register_model and get_registered_model, this proves that self.all_models[app_label] doesn't contain model._meta.model_name in register_model, allowing us to simplify the implementation.
2013-12-27Amend test table name so it doesn't clash.Ramiro Morales
Refs #21692 and 3efd1b8b939.
2013-12-27Merge pull request #2120 from ramiro/schema-creation-quotingRamiro Morales
Fixed #21692 -- Quote table name when creating it.
2013-12-27Avoided %r formatting on possibly unicode strings.Aymeric Augustin
The u prefix looks bad on Python 2.
2013-12-27Fixed #21692 -- Quote table name when creating it.Ramiro Morales
2013-12-27Refactored dumpdata with app configs instead of models modules.Aymeric Augustin
2013-12-27Fixed a couple flake8 warnings.Aymeric Augustin
2013-12-27Fixed #21650 -- Corrected bad advice for plural translation.Tim Graham
Thanks nedbatchelder and claudep.
2013-12-27Created a constant for the migrations module name.Aymeric Augustin
Mostly for consistency with MODELS_MODULE_NAME; it's unlikely to change.
2013-12-27Don't try to load app directory templates from apps with a path (eg eggs)Florian Apolloner
2013-12-27Properly app_template_dirs when INSTALLED_APPS change.Florian Apolloner
2013-12-26Fixed #21582 -- Corrected URL namespace example.Tim Graham
Thanks oubiga for the report.
2013-12-27Switched setup.py to setuptools.Florian Apolloner
2013-12-26Used app_config.verbose_name instead of app_label|capfirst.Aymeric Augustin
An admin view performed the capitalization in the template, unlike all others. Refs #10436.
2013-12-26Fixed #21629 -- Added instructions for loading MySQL time zone definitions.Tim Graham
Thanks Aymeric for the suggestion.
2013-12-26Added a test for Apps.has_app.Aymeric Augustin
2013-12-26Fixed #21609 -- Amended CONTRIBUTING.rst pull request guidelines.Tim Graham
Thanks cjerdonek for the suggestion.
2013-12-26Added file forgotten in previous commit, plus one more test.Aymeric Augustin
2013-12-26Added tests for invalid values of INSTALLED_APPS.Aymeric Augustin
2013-12-26Normalized exceptions raised by AppConfig.create.Aymeric Augustin
It raises ImportError whenever an entry in INSTALLED_APPS points (directly or indirectly via AppConfig.name) to a non-existing module and ImproperlyConfigured in all other cases. Catching ImportError and re-raising ImproperlyConfigured tends to make circular imports more difficult to diagnose.
2013-12-26Made the AppConfig API marginally more consistent.Aymeric Augustin
Eliminated the app_ prefix that was more confusing than useful.
2013-12-26Made unset_installed_apps reset the app registry state.Aymeric Augustin
Previously the _apps/models_loaded flags could remain set to False if set_installed_apps exited with an exception, which is going to happen as soon as we add tests for invalid values of INSTALLED_APPS.
2013-12-26Added basic tests for get_app_config[s].Aymeric Augustin
2013-12-26Fixed #21206 -- No longer run discovery if the test label doesn't point to a ↵Preston Timmons
package or directory. Thanks thepapermen for the report and Carl Meyer for the review.
2013-12-26Turned apps.ready into a property. Added tests.Aymeric Augustin
2013-12-26Beefed up the comments for AppConfig.all_models.Aymeric Augustin
2013-12-26Removed a few gratuitous lambdas.Aymeric Augustin
2013-12-26Added missing newline in previous commit.Tim Graham
2013-12-26Fixed #21627 -- Added unicode_literals to changepassword command.Jon Lønne
Fixed a crash when executing changepassword command when the user object representation contained non-ASCII characters.