summaryrefslogtreecommitdiff
path: root/django/db/models
AgeCommit message (Collapse)Author
2013-08-30Fixed #20988 -- Added model meta option select_on_saveAnssi Kääriäinen
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
2013-08-30Removed stale add_q() commentAnssi Kääriäinen
2013-08-29Fixed #20989 -- Removed explicit list comprehension inside dict() and tuple()Tim Graham
Thanks jeroen.pulles at redslider.net for the suggestion and helper script.
2013-08-29Fixed #14786 -- Fixed get_db_prep_lookup calling get_prep_value twice if ↵Tim Graham
prepared is False. Thanks homm for the report and Aramgutang and lrekucki for work on the patch.
2013-08-23Merge remote-tracking branch 'core/master' into schema-alterationAndrew Godwin
Conflicts: django/db/backends/oracle/base.py django/db/backends/postgresql_psycopg2/base.py django/db/models/signals.py tests/queries/tests.py
2013-08-22Fixed model.__eq__ and __hash__ for no pk value casesAnssi Kääriäinen
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.
2013-08-22Fixed #20955 -- select_related regressionAnssi Kääriäinen
In cases where the same connection (from model A to model B along the same field) was needed multiple times in a select_related query, the join setup code mistakenly reused an existing join.
2013-08-21Fixed a regression with get_or_create and virtual fields.Tim Graham
refs #20429 Thanks Simon Charette for the report and review.
2013-08-21Fixed #20946 -- model inheritance + m2m failureAnssi Kääriäinen
Cleaned up the internal implementation of m2m fields by removing related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing if asked for the foreign key value on foreign key to parent model's primary key when child model had different primary key field.
2013-08-21Fixed #20820 -- Model inheritance + m2m fixture loading regressionAnssi Kääriäinen
Tests by Tim Graham, report from jeroen.pulles@redslider.net.
2013-08-21Fixed #14056 -- Made sure LEFT JOIN aren't trimmed in ORDER BYAnssi Kääriäinen
If LEFT JOINs are required for correct results, then trimming the join can lead to incorrect results. Consider case: TBL A: ID | TBL B: ID A_ID 1 1 1 2 Now A.order_by('b__a') did use a join to B, and B's a_id column. This was seen to contain the same value as A's id, and so the join was trimmed. But this wasn't correct as the join is LEFT JOIN, and for row A.id = 2 the B.a_id column is NULL.
2013-08-21Fixed #20943 -- Weakly reference senders when caching their associated receiversSimon Charette
2013-08-21Fixed a regression with get_or_create and virtual fields.Tim Graham
refs #20429 Thanks Simon Charette for the report and review.
2013-08-21Fixed #20946 -- model inheritance + m2m failureAnssi Kääriäinen
Cleaned up the internal implementation of m2m fields by removing related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing if asked for the foreign key value on foreign key to parent model's primary key when child model had different primary key field.
2013-08-20Fixed #20820 -- Model inheritance + m2m fixture loading regressionAnssi Kääriäinen
Tests by Tim Graham, report from jeroen.pulles@redslider.net.
2013-08-20Fixed #14056 -- Made sure LEFT JOIN aren't trimmed in ORDER BYAnssi Kääriäinen
If LEFT JOINs are required for correct results, then trimming the join can lead to incorrect results. Consider case: TBL A: ID | TBL B: ID A_ID 1 1 1 2 Now A.order_by('b__a') did use a join to B, and B's a_id column. This was seen to contain the same value as A's id, and so the join was trimmed. But this wasn't correct as the join is LEFT JOIN, and for row A.id = 2 the B.a_id column is NULL.
2013-08-20Fixed #20943 -- Weakly reference senders when caching their associated receiversSimon Charette
2013-08-19Merge remote-tracking branch 'core/master' into schema-alterationAndrew Godwin
Conflicts: docs/ref/django-admin.txt
2013-08-19Fixed #11881 -- removed junk from aggregation subqueriesAnssi Kääriäinen
There were clauses that weren't needed in the subqueries. These were ORDER BY, SELECT FOR UPDATE and related selections.
2013-08-19Fixed #12886 -- aggregation over sliced querysetAnssi Kääriäinen
2013-08-19Add more stringent M2M tests and fix the bug they exposedAndrew Godwin
2013-08-19Made Model.__eq__ consider proxy models equivalentAnssi Kääriäinen
Fixed #11892, fixed #16458, fixed #14492.
2013-08-13Fixed #20883 -- Made model inheritance find parent links in abstract parentsLoic Bistuer
2013-08-13Fixed #20874 -- bump_prefix() in nested subqueriesAnssi Kääriäinen
Also made some cleanup to build_filter() code by introducing submethods solve_lookup_type() and prepare_lookup_value().
2013-08-09Merge remote-tracking branch 'core/master' into schema-alterationAndrew Godwin
Conflicts: django/db/models/options.py
2013-08-09Fixed #9057 -- Added default_permissions model meta option.Tim Graham
Thanks hvendelbo for the suggestion and koenb for the draft patch.
2013-08-09Merge remote-tracking branch 'core/master' into schema-alterationAndrew Godwin
Conflicts: django/core/management/commands/flush.py django/core/management/commands/syncdb.py django/db/models/loading.py docs/internals/deprecation.txt docs/ref/django-admin.txt docs/releases/1.7.txt
2013-08-07Fixed #17424 -- annotate() + exclude() bugAnssi Kääriäinen
The bug was already fixed by 01b9c3d5193fe61b82ae8b26242a13fdec22f211, so only tests added. At the same time promote_joins()'s uncoditional flag is gone, it isn't needed for anything any more.
2013-08-06Fixed #19918 -- Modified select_for_update to run on the write database.Alex Cucu
2013-08-05Fixed #17667 -- Prevented app loading from skipping nonexistent apps after ↵Tim Graham
the first try Thanks ea2100@ for the report and akaariai for the patch.
2013-08-04Deprecated SortedDict (replaced with collections.OrderedDict)Curtis Maloney
Thanks Loic Bistuer for the review.
2013-08-01Removed unused model option "admin"Tim Graham
2013-07-31Fixed #20649 -- Allowed blank field display to be defined in the initial ↵Alex Couper
list of choices.
2013-07-31Fixed #20826 -- Moved Manager.raw() and Manager._insert() to the QuerySet class.Loic Bistuer
2013-07-31Fixed #15624 -- Made sure aggregations are present in SELECTFlorian Hahn
2013-07-31Added field.attname to Options.name_mapAnssi Kääriäinen
The change also removed allow_explicit_fk from sql/query.py.
2013-07-31Fixed #20348 -- Consistently handle Promise objects in model fields.Tai Lee
All Promise objects were passed to force_text() deep in ORM query code. Not only does this make it difficult or impossible for developers to prevent or alter this behaviour, but it is also wrong for non-text fields. This commit changes `Field.get_prep_value()` from a no-op to one that resolved Promise objects. All subclasses now call super() method first to ensure that they have a real value to work with.
2013-07-30Rename pre_ and post_syncdb to *_migrate, with aliases from old namesAndrew Godwin
2013-07-29Removed most of absolute_import importsClaude Paroz
Should be unneeded with Python 2.7 and up. Added some unicode_literals along the way.
2013-07-29Deprecated django.utils.importlibClaude Paroz
This was a shim for pre-Python 2.7 support.
2013-07-27Fixed a number of minor misspellings.Julien Phalip
2013-07-26Fixed related model lookup regressionAnssi Kääriäinen
It has been possible to use models of wrong type in related field lookups. For example pigs__in=[a_duck] has worked. Changes to ForeignObject broke that. It might be a good idea to restrict the model types usable in lookups. This should be done intentionally, not accidentally and without any consideration for deprecation path.
2013-07-26Fixed #20625 -- Chainable Manager/QuerySet methods.Loic Bistuer
Additionally this patch solves the orthogonal problem that specialized `QuerySet` like `ValuesQuerySet` didn't inherit from the current `QuerySet` type. This wasn't an issue until now because we didn't officially support custom `QuerySet` but it became necessary with the introduction of this new feature. Thanks aaugustin, akaariai, carljm, charettes, mjtamlyn, shaib and timgraham for the reviews.
2013-07-25Fixed ._meta.pk_index() virtual field failureAnssi Kääriäinen
2013-07-24Fixed #14300 -- Fixed initial SQL location if models is a package.Tim Graham
Thanks al_the_x for the report and fheinz for the draft patch.
2013-07-23Fixed #20761 -- Reworded ForeignKey default error messageersran9
2013-07-23Fixed test failures introduced in e716518ad29898fb25c820023aaf2fdd1c9eb4afTim Graham
refs #20761
2013-07-23Fixed #20761 -- Fixed DatabaseError handling in get_or_create and ↵Loic Bistuer
update_or_create.
2013-07-23Minor change to get_extra_descriptor_filter()Anssi Kääriäinen
Refs #20611.
2013-07-23Fixed #20782 -- qs.values().aggregate() failureAnssi Kääriäinen
In the combination of .values().aggregate() the aggregate_select_mask didn't include the aggregates added. This resulted in bogus query. Thanks to Trac alias debanshuk for report.