django1/tests
Anssi Kääriäinen d3f00bd570 Refactored qs.add_q() and utils/tree.py
The sql/query.py add_q method did a lot of where/having tree hacking to
get complex queries to work correctly. The logic was refactored so that
it should be simpler to understand. The new logic should also produce
leaner WHERE conditions.

The changes cascade somewhat, as some other parts of Django (like
add_filter() and WhereNode) expect boolean trees in certain format or
they fail to work. So to fix the add_q() one must fix utils/tree.py,
some things in add_filter(), WhereNode and so on.

This commit also fixed add_filter to see negate clauses up the path.
A query like .exclude(Q(reversefk__in=a_list)) didn't work similarly to
.filter(~Q(reversefk__in=a_list)). The reason for this is that only
the immediate parent negate clauses were seen by add_filter, and thus a
tree like AND: (NOT AND: (AND: condition)) will not be handled
correctly, as there is one intermediary AND node in the tree. The
example tree is generated by .exclude(~Q(reversefk__in=a_list)).

Still, aggregation lost connectors in OR cases, and F() objects and
aggregates in same filter clause caused GROUP BY problems on some
databases.

Fixed #17600, fixed #13198, fixed #17025, fixed #17000, fixed #11293.
2013-03-13 10:44:49 +02:00
..
admin_changelist Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
admin_custom_urls Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
admin_filters Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
admin_inlines Fixed #19838 -- Admin: Don't leak a 500 HTTP status when trying to delete protected FKs. 2013-03-04 13:30:59 -03:00
admin_ordering Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
admin_registration Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
admin_scripts Fixed #19923 -- Display tracebacks for non-CommandError exceptions 2013-03-09 12:38:45 +01:00
admin_util Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
admin_validation Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
admin_views Adjusted query counts to account for new savepoints. 2013-03-11 21:07:19 +01:00
admin_widgets Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
aggregation Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
aggregation_regress Refactored qs.add_q() and utils/tree.py 2013-03-13 10:44:49 +02:00
app_loading Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
backends Ran a test that closes the database connection outside of a transaction. 2013-03-11 19:42:59 +01:00
base Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
bash_completion Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
basic Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
bug639 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
bug8245 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
builtin_server Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
bulk_create Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
cache [py3] Always fed hashlib with bytes. 2013-02-27 10:02:07 +01:00
choices Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
commands_sql Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
comment_tests Remove a special case for comment tests from runtests.py. 2013-03-11 15:38:53 -05:00
conditional_processing Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
context_processors Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
createsuperuser Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
csrf_tests Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
custom_columns Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
custom_columns_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
custom_managers Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
custom_managers_regress Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
custom_methods Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
custom_pk Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
datatypes Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
dates Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
datetimes Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
db_typecasts Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
decorators Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
defaultfilters Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
defer Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
defer_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
delete Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
delete_regress Made transaction.managed a no-op and deprecated it. 2013-03-11 14:48:53 +01:00
deprecation Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
dispatch Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
distinct_on_fields Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
empty Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
expressions Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
expressions_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
extra_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
field_defaults Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
field_subclassing Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
file_storage Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
file_uploads Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
files Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
fixtures Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
fixtures_model_package Improved the API of set_autocommit. 2013-03-11 15:10:58 +01:00
fixtures_regress Improved the API of set_autocommit. 2013-03-11 15:10:58 +01:00
force_insert_update Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
forms_tests Removed forced settings in runtests 2013-03-11 17:46:56 +01:00
generic_inline_admin Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
generic_relations Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
generic_relations_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
generic_views Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
get_earliest_or_latest Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
get_object_or_404 Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
get_or_create Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
get_or_create_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
handlers Deprecated TransactionMiddleware and TRANSACTIONS_MANAGED. 2013-03-11 15:04:05 +01:00
http_utils Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
httpwrappers Implemented persistent database connections. 2013-02-28 15:28:13 +01:00
i18n Made (make|compile)messages check for availability of gettext commands. 2013-03-10 17:31:11 -03:00
indexes Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
initial_sql_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
inline_formsets Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
inspectdb Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
introspection Add introspection support for BinaryField 2013-03-02 10:29:03 +01:00
invalid_models Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
known_related_objects Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
logging_tests Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
lookup Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2m_and_m2o Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2m_intermediary Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2m_multiple Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2m_recursive Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2m_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2m_signals Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2m_through Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2m_through_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
m2o_recursive Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
mail Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
managers_regress Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
many_to_many Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
many_to_one Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
many_to_one_null Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
many_to_one_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
max_lengths Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
middleware Fixed tests that relied on MANAGERS not being empty. 2013-03-11 23:30:02 +01:00
middleware_exceptions Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
model_fields Add a BinaryField model field 2013-03-02 10:29:02 +01:00
model_forms Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
model_forms_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
model_formsets Fixed #18898 -- Added tests with a fix for ModelMultipleChoiceField 2013-03-01 09:35:18 +01:00
model_formsets_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
model_inheritance Import `CaptureQueriesContext` from its original module. 2013-03-02 03:45:42 -05:00
model_inheritance_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
model_inheritance_same_model_name Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
model_inheritance_select_related Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
model_package Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
model_permalink Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
model_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
modeladmin Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
multiple_database Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
mutually_referential Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
nested_foreign_keys Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
null_fk Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
null_fk_ordering Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
null_queries Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
one_to_one Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
one_to_one_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
or_lookups Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
order_with_respect_to Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
ordering Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
pagination Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
prefetch_related Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
properties Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
proxy_model_inheritance Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
proxy_models Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
queries Refactored qs.add_q() and utils/tree.py 2013-03-13 10:44:49 +02:00
queryset_pickle Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
raw_query Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
requests Made transaction.managed a no-op and deprecated it. 2013-03-11 14:48:53 +01:00
reserved_names Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
resolve_url Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
reverse_lookup Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
reverse_single_related Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
save_delete_hooks Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
select_for_update Made transaction.managed a no-op and deprecated it. 2013-03-11 14:48:53 +01:00
select_related Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
select_related_onetoone Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
select_related_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
serializers Made transaction.managed a no-op and deprecated it. 2013-03-11 14:48:53 +01:00
serializers_regress Added support for serializing BinaryField 2013-03-02 10:29:02 +01:00
servers Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
settings_tests Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
signals Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
signals_regress Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
signed_cookies_tests Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
signing Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
sites_framework Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
special_headers Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
staticfiles_tests Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
str Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
string_lookup Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
swappable_models Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
syndication Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
tablespaces Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
template_tests Fixed #19915 - Made blocktrans tag honor TEMPLATE_STRING_IF_INVALID. 2013-03-03 16:10:11 -03:00
templates Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
test_client Removed mentions of modeltests. 2013-03-03 18:44:06 -03:00
test_client_regress Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
test_runner Changed test_runner tests to use full python path for settings files. 2013-02-26 16:02:24 +01:00
test_utils Added a context manager to capture queries while testing. 2013-03-02 02:41:14 -05:00
text Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
timezones Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
transactions Fixed #20028 -- Made atomic usable on callable instances. 2013-03-12 10:52:16 +01:00
transactions_regress Updated a test that doesn't make sense with autocommit. 2013-03-11 15:05:04 +01:00
unmanaged_models Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
update Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
update_only_fields Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
urlpatterns_reverse Fixed #20019 -- Ensured HttpRequest.resolver_match always exists. 2013-03-10 23:28:19 +01:00
user_commands Made (make|compile)messages check for availability of gettext commands. 2013-03-10 17:31:11 -03:00
utils_tests Merge pull request #882 from loic/testfix 2013-03-06 16:22:06 -08:00
validation Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
validators Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
version Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
view_tests Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
wsgi Implemented persistent database connections. 2013-02-28 15:28:13 +01:00
.coveragerc Adjusted coveragerc 2013-02-26 14:36:57 +01:00
runtests.py Remove a special case for comment tests from runtests.py. 2013-03-11 15:38:53 -05:00
test_sqlite.py Updated an inaccurate comment. 2013-02-26 10:00:14 +01:00
urls.py Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00