Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/django/db/models/base.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Edited model check messages for grammar and consistency.Russell Keith-Magee2014-03-031-51/+47
|
* Fixed #17673 -- Forbid field shadowing.Christopher Medrela2014-02-101-2/+61
| | | | Thanks Anssi Kääriäinen for the suggestion.
* Fixed #16192 -- Made unique error messages in ModelForm ↵Loic Bistuer2014-02-081-20/+36
| | | | | | | | | | | | | | customizable. Overriding the error messages now works for both unique fields, unique_together and unique_for_date. This patch changed the overriding logic to allow customizing NON_FIELD_ERRORS since previously only fields' errors were customizable. Refs #20199. Thanks leahculver for the suggestion.
* Fixed #21877 -- Renamed django.apps.base to config.Aymeric Augustin2014-01-261-1/+1
|
* Took advantage of the new get_model API. Refs #21702.Aymeric Augustin2014-01-261-18/+16
|
* Fixed #16905 -- Added extensible checks (nee validation) ↵Russell Keith-Magee2014-01-201-0/+303
| | | | | | | | | | | framework This is the result of Christopher Medrela's 2013 Summer of Code project. Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian Apolloner, and Alex Gaynor for review notes along the way. Also: Fixes #8579, fixes #3055, fixes #19844.
* Fixed #21664: Multi-table inheritance was duplicating ↵Andrew Godwin2014-01-191-1/+4
| | | | _ptr fields
* Fixed #21794 -- Adjusted warning for abstract models.Aymeric Augustin2014-01-181-5/+9
| | | | | | As far as I can tell, they don't need an app_label. Thanks Simon Charette for the report and the review.
* Deprecated importing a model before loading its application.Aymeric Augustin2014-01-101-1/+9
| | | | Refs #21719, #21680.
* Fixed #21711 -- Enforced unicity of model names.Aymeric Augustin2014-01-051-12/+1
|
* Made it possible to change an application's label in its ↵Aymeric Augustin2013-12-311-14/+26
| | | | | | configuration. Fixed #21683.
* Changed get_model to raise an exception on errors.Aymeric Augustin2013-12-281-3/+4
| | | | | | | | | | | | 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.
* Renamed AppCache to Apps.Aymeric Augustin2013-12-241-5/+5
| | | | | | Also renamed app_cache to apps and "app cache" to "app registry". Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
* Renamed has_model to get_registered_models.Aymeric Augustin2013-12-221-2/+2
| | | | That matches its return type better.
* Moved apps back in the toplevel django namespace.Aymeric Augustin2013-12-221-2/+2
| | | | Reverted 4a56a93cc458e9ab4dcab95d9f5067d4975dd1a2.
* Renamed registered_model to has_model.Aymeric Augustin2013-12-221-2/+2
| | | | | | This avoids possible confusion with register_model. Thanks Marc Tamlyn for the suggestion.
* Terminated AppCache._populate() with extreme prejudice.Aymeric Augustin2013-12-221-1/+1
| | | | | | | | | | 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.
* Refactored registration of models.Aymeric Augustin2013-12-221-4/+2
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Moved the new app cache inside core.Aymeric Augustin2013-12-171-2/+2
|
* Simplified register_models.Aymeric Augustin2013-12-171-1/+1
| | | | | Since it's never called with more than one model at a time the current signature is needlessly complicated.
* Removed module-level functions for the app cache.Aymeric Augustin2013-12-171-2/+3
| | | | | | | | | | | | | | | 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.
* Moved django.db.models.loading to django.apps.cache.Aymeric Augustin2013-12-171-1/+1
| | | | This commit doesn't contain any code changes; it's purely a refactoring.
* Fixed E127 pep8 warnings.Loic Bistuer2013-12-141-11/+15
|
* Fixed #20867 -- Added the Form.add_error() method.Loic Bistuer2013-11-291-1/+1
| | | | | | Refs #20199 #16986. Thanks @akaariai, @bmispelon, @mjtamlyn, @timgraham for the reviews.
* Fixed all E261 warningscoagulant2013-11-021-1/+1
|
* Fixed #21302 -- Fixed unused imports and import *.Tim Graham2013-11-021-2/+2
|
* Fixed #21288 -- Fixed E126 pep8 warningsAlasdair Nicol2013-10-211-13/+17
|
* Fixed #21285 -- Fixed E121,E122 pep8 warningsAlasdair Nicol2013-10-181-2/+2
|
* Fixed #21198 -- Prevented invalid use of ↵Aymeric Augustin2013-10-131-5/+0
| | | | | | | | @python_2_unicode_compatible. Thanks jpic for the report and chmodas for working on a patch. Reverts 2ea80b94. Refs #19362.
* Fixed assorted flake8 errors.Tim Graham2013-10-111-1/+1
|
* Fixed "redefinition of unused 'foo' from line X" ↵Tim Graham2013-10-101-1/+1
| | | | pyflakes warnings.
* Fixed #11811 -- Data-loss bug in queryset.update.Aymeric Augustin2013-09-071-0/+2
| | | | | It's now forbidden to call queryset.update(field=instance) when instance hasn't been saved to the database ie. instance.pk is None.
* Replaced "not PY3" by "PY2", new in six 1.4.0.Aymeric Augustin2013-09-021-2/+2
|
* Fixed #20989 -- Removed useless explicit list ↵Simon Charette2013-08-301-2/+2
| | | | comprehensions.
* Fixed #20988 -- Added model meta option select_on_saveAnssi Kääriäinen2013-08-301-5/+13
| | | | | | | | | | | The option can be used to force pre 1.6 style SELECT on save behaviour. This is needed in case the database returns zero updated rows even if there is a matching row in the DB. One such case is PostgreSQL update trigger that returns NULL. Reviewed by Tim Graham. Refs #16649
* Merge remote-tracking branch 'core/master' into ↵Andrew Godwin2013-08-231-3/+10
|\ | | | | | | | | | | | | | | | | | | schema-alteration Conflicts: django/db/backends/oracle/base.py django/db/backends/postgresql_psycopg2/base.py django/db/models/signals.py tests/queries/tests.py
| * Fixed model.__eq__ and __hash__ for no pk value casesAnssi Kääriäinen2013-08-221-3/+10
| | | | | | | | | | | | | | | | | | | | The __eq__ method now considers two instances without primary key value equal only when they have same id(). The __hash__ method raises TypeError for no primary key case. Fixed #18864, fixed #18250 Thanks to Tim Graham for docs review.
* | Merge remote-tracking branch 'core/master' into ↵Andrew Godwin2013-08-191-6/+19
|\| | | | | | | | | | | | | schema-alteration Conflicts: docs/ref/django-admin.txt
| * Made Model.__eq__ consider proxy models equivalentAnssi Kääriäinen2013-08-191-1/+3
| | | | | | | | Fixed #11892, fixed #16458, fixed #14492.
| * Fixed #20883 -- Made model inheritance find parent links ↵Loic Bistuer2013-08-131-5/+16
| | | | | | | | in abstract parents
* | Merge branch 'master' into schema-alterationAndrew Godwin2013-07-221-7/+19
|\| | | | | | | | | | | | | | | | | Conflicts: django/db/backends/mysql/introspection.py django/db/backends/oracle/creation.py django/db/backends/postgresql_psycopg2/creation.py django/db/models/base.py django/db/models/loading.py
| * Fixed #14007 -- Added model discovery in models module ↵Tim Graham2013-07-171-3/+15
| | | | | | | | | | | | without the need to specify app_label. Thanks mark@ and Aramgutang for work on the patch.
| * A large number of stylistic cleanups across django/db/Alex Gaynor2013-07-081-5/+4
| |
* | Merge remote-tracking branch 'core/master' into ↵Andrew Godwin2013-06-191-15/+28
|\| | | | | | | | | | | | | schema-alteration Conflicts: django/db/models/loading.py
| * Refactored ValidationError to allow persisting error ↵Loic Bistuer2013-06-181-9/+10
| | | | | | | | params and error codes as the exception bubbles up
| * Fixed #20289 -- pickling of dynamic modelsAnssi Kääriäinen2013-06-141-6/+18
| |
* | Merge remote-tracking branch 'core/master' into ↵Andrew Godwin2013-06-071-11/+11
|\| | | | | | | | | | | | | schema-alteration Conflicts: django/db/models/fields/related.py
| * Fixed #20272 - Moved update_fields existence check into ↵Tim Graham2013-05-301-11/+11
| | | | | | | | | | | | Model._do_update. Thanks Gavin Wahl.
* | Merge branch 'master' into schema-alterationAndrew Godwin2013-05-181-5/+5
|\|
| * Replaced an antiquated pattern.Aymeric Augustin2013-05-171-5/+5
| | | | | | | | Thanks Lennart Regebro for pointing it out.