Commit Graph

6147 Commits

Author SHA1 Message Date
Alexander Shchapov e1513a7960 Fixed #18586 -- Split up model_package.ModelPackageTests. 2014-12-01 12:49:45 -05:00
wrwrwr b481c85697 Corrected a docstring in tests/migrations/test_operations.py. 2014-12-01 11:37:51 -05:00
wrwrwr 3a8799c8a4 Removed an incorrect docstring in tests/multiple_database/tests.py. 2014-12-01 11:37:08 -05:00
wrwrwr fce2890e92 Removed a no-op statement in tests/multiple_database/tests.py. 2014-12-01 11:36:54 -05:00
wrwrwr 9136ceb6fb Replaced router.routers usage with override_settings(DATABASE_ROUTERS); refs #23933. 2014-12-01 11:34:15 -05:00
wrwrwr e6f19ec322 Fixed #23933 -- Made override_settings(DATABASE_ROUTERS) affect the master router. 2014-12-01 11:30:50 -05:00
Markus Holtermann d2202ec2d4 Fixed #23880 -- Added missing index_together handling for SQLite 2014-12-01 11:30:33 +07:00
wrwrwr 6dbe979b4d Fixed #23930 -- Added copies of captured_std* managers from CPython's test.support.
StringIO import was adapted for compatibility with Python 2.
2014-11-29 11:21:58 -05:00
Berker Peksag c8dcded930 Fixed #17890 -- Added an extra_context parameter to AdminSite.password_change(). 2014-11-29 10:31:09 -05:00
Tim Graham 3131e9cef5 Fixed #23923 -- Promoted Django's deprecation warnings to errors in runtests.py 2014-11-29 10:27:04 -05:00
Tim Graham 8402909876 Silenced all admin validation warnings.
Warnings could escape depending on the order in which tests were run.
2014-11-28 19:00:08 -05:00
Thomas Chaumeny 17fe0bd808 Fixed #23423 -- Added unaccent lookup in django.contrib.postgres 2014-11-28 18:22:20 -05:00
Berker Peksag 47789410db Corrected deprecation warnings for RedirectView; refs #21587. 2014-11-28 17:59:55 -05:00
Tim Heap deb607648e Fixed #23728 -- Added the --exit option to makemigrations.
If no changes that need migrations are found, `makemigrations --exit`
exits with error code 1.
2014-11-28 07:48:39 -05:00
Anssi Kääriäinen ab89414f40 Fixed #23853 -- Added Join class to replace JoinInfo
Also removed Query.join_map. This structure was used to speed up join
reuse calculation. Initial benchmarking shows that this isn't actually
needed. If there are use cases where the removal has real-world
performance implications, it should be relatively straightforward to
reintroduce it as map {alias: [Join-like objects]}.
2014-11-28 07:30:26 -05:00
Anssi Kääriäinen c7175fcdfe Fixed #901 -- Added Model.refresh_from_db() method
Thanks to github aliases dbrgn, carljm, slurms, dfunckt, and timgraham
for reviews.
2014-11-28 06:54:00 -05:00
Markus Holtermann 912ad03226 Fixed #23894 -- Made deconstruct methods favor kwargs over args 2014-11-28 06:05:56 -05:00
Martin Blech e023ceb453 Fixed #23910 -- Added reply_to parameter to EmailMessage
Thanks to Berker Peksag and Tim Graham for the review and suggestions.
2014-11-28 06:00:06 -05:00
Thomas Chaumeny 6b5d82749c Fixed #16731 -- Made pattern lookups work properly with F() expressions 2014-11-28 12:50:42 +02:00
Diego Guimarães f39b0421b4 Fixed #23338 -- Added warning when unique=True on ForeigKey
Thanks Jonathan Lindén for the initial patch, and Tim Graham
and Gabe Jackson for the suggestions.
2014-11-27 19:42:30 -05:00
Martin Blech abf87333a1 Fixed #23924 -- Made EmailMessage raise TypeError for type checks 2014-11-27 18:43:45 -05:00
wrwrwr 7cd3f1c295 Fixed cache state dependence for assertNumQueries in test_group_permission_performance.
Refs #20432 and #23746.
2014-11-27 13:02:21 -05:00
Berker Peksag 093e6c68b9 Fixed #14664 -- Logged a warning if MiddlewareNotUsed is raised in DEBUG mode. 2014-11-27 07:55:07 -05:00
Anssi Kääriäinen bd337184f1 Fixed #23877 -- aggregation's subquery missed target col
Aggregation over subquery produced syntactically incorrect queries in
some cases as Django didn't ensure that source expressions of the
aggregation were present in the subquery.
2014-11-27 06:50:08 -05:00
MattBlack85 e9d1f1182a Fixed #23801 -- Added warning when max_length is used with IntegerField 2014-11-26 18:41:54 -05:00
Anssi Kääriäinen cbb5cdd155 Fixed #23867 -- removed DateQuerySet hacks
The .dates() queries were implemented by using custom Query, QuerySet,
and Compiler classes. Instead implement them by using expressions and
database converters APIs.
2014-11-26 17:49:25 -05:00
Baptiste Mispelon c335c0fee9 Fixed #23914 -- Improved {% now %} to allow storing its result in the context.
Thanks to Tim for the review.
2014-11-25 22:11:35 +01:00
Simon Charette 3a9aa155e2 Fixed #23915 -- Made sure m2m fields through non-pk to_field are allowed in the admin.
refs #23754, #23862
2014-11-25 15:28:21 -05:00
Simon Charette f9c4e14aec Fixed #23754 -- Always allowed reference to the primary key in the admin
This change allows dynamically created inlines "Add related" button to work
correcly as long as their associated foreign key is pointing to the primary
key of the related model.

Thanks to amorce for the report, Julien Phalip for the initial patch,
and Collin Anderson for the review.
2014-11-25 13:26:50 -05:00
Redouane Zait 8e7b384d89 Fixed #23898 -- Added missing context to admin's deleted_selected view.
Thanks Redouane Zait for the report.
2014-11-25 11:22:15 -05:00
Tim Graham 392e11945f Fixed flake8 warnings. 2014-11-25 11:20:40 -05:00
Luke Plant ff3d746e8d Fixed bug in circular dependency algo for migration dependencies.
Previous algo only worked if the first item was a part of the loop,
and you would get an infinite loop otherwise (see test).

To fix this, it was much easier to do a pre-pass.

A bonus is that you now get an error message that actually helps you debug
the dependency problem.
2014-11-25 15:37:34 +00:00
wrwrwr 056a3c6c37 Fixed #23682 -- Enhanced circular redirects detection in tests.
When the test client detects a redirect to a URL seen in the
currently followed chain it will now raise a RedirectCycleError
instead of just returning the first repeated response.

It will also complain when a single chain of redirects is longer
than 20, as this often means a redirect loop with varying URLs,
and even if it's not actually one, such long chains are likely
to be treated as loops by browsers.

Thanks Preston Timmons, Berker Peksag, and Tim Graham for reviews.
2014-11-25 10:12:28 -05:00
Adam Alton a973fb2d68 Fixed and restored assertions in OneToOneTests.test_foreign_key.
These assertions had been removed in 34ba86706f and 7fe554b2a3,
seemingly because they were referencing the wrong objects, and so
they started failing when the checking of object types (as well as
PK values) was introduced.
2014-11-25 09:47:32 -05:00
Berker Peksag 9a30acad8a Fixed #21587 -- Added a warning for changing default of RedirectView.permanent. 2014-11-25 09:22:18 -05:00
Tim Graham d43dd03ca3 Fixed #23890 -- Silenced numpy DeprecationWarnings in template tests. 2014-11-25 09:09:13 -05:00
wrwrwr e22c64dfc0 Fixed #23742 -- Added an option to reverse tests order.
This is useful for debugging side effects affecting tests that
are usually executed before a given test. Full suite and pair
tests sort cases more or less deterministically, thus some test
cross-dependencies are easier to reveal by reversing the order.

Thanks Preston Timmons for the review.
2014-11-24 19:24:11 -05:00
wrwrwr 31f85bae1e Changed test_runner imports to name objects imported from test.runner. 2014-11-24 17:31:39 -05:00
Sergey Fedoseev 1e9ac504e4 Fixed #23888 -- Fixed crash in File.__repr__() when name contains unicode. 2014-11-24 15:54:57 -05:00
Aymeric Augustin 47a131b944 Encapsulated TEMPLATE_STRING_IF_INVALID in Engine. 2014-11-23 11:53:53 +01:00
Aymeric Augustin 29a977ab14 Moved template loaders management in Engine.
Passed the engine instance to loaders. This is a prerequisite for
looking up configuration on the engine instance instead of global
settings.

This is backwards incompatible for custom template loaders that override
__init__. However the documentation doesn't talk about __init__ and the
way to pass arguments to custom template loaders isn't specified. I'm
considering it a private API.
2014-11-23 11:52:12 +01:00
Aymeric Augustin 17012b6936 Deprecated dirs argument to override TEMPLATE_DIRS.
Cancels 2f0566fa. Refs #4278.
2014-11-23 09:29:33 +01:00
Berker Peksag da2a35cf9e Silenced a flake8 warning.
../tests/shortcuts/views.py:45:1: E302 expected 2 blank lines, found 1
2014-11-22 21:39:06 +02:00
Aymeric Augustin 7331788300 Avoided rewrapping Contexts in render_to_response.
This change preserves backwards-compatibility for a very common misuse
of render_to_response which even occurred in the official documentation.

It fixes that misuse wherever it happened in the code base and docs.

Context.__init__ is documented as accepting a dict and nothing else.
Since Context is dict-like, Context(Context({})) could work to some
extent. However, things get complicated with RequestContext and that
gets in the way of refactoring the template engine. This is the real
rationale for this change.
2014-11-22 17:58:38 +01:00
Aymeric Augustin bf1bd0fbc9 Moved tests for render shortcuts to their own app. 2014-11-22 17:52:43 +01:00
Claude Paroz b38637d581 Fixed #23887 -- Returned Bad Request for multipart parsing fails
Thanks Antti Häyrynen and Tim Graham for the report, and Aymeric
Augustin for the review.
2014-11-22 14:23:37 +01:00
Simon Charette c7087bc777 Fixed #23862 -- Made ManyToManyRel.get_related_field() respect to_field. 2014-11-21 16:02:31 -05:00
Berker Peksag 343162410f Fixed #21753 -- Raised exception when both `form_class` and `fields` are specified. 2014-11-21 14:23:17 -05:00
Alasdair Nicol 5b26a014a8 Fixed #23865 -- documented how to assign errors to a field in Model.clean()
Also added a unit test wit the simpler syntax which we have documented,
where the dictionary values are strings.
2014-11-21 13:01:28 -05:00
Simon Charette 8330b50c85 Fixed #23863 -- Made runtests accept the keepdb option.
refs #20550
2014-11-21 11:41:13 -05:00
Andrzej Pragacz 72729f844e Fixed #23794 -- Fixed migrations crash when removing a field that's part of index/unique_together. 2014-11-21 10:55:19 -05:00
Jay f957e2b04c Added a test for model pre/post_init signals. 2014-11-21 10:39:37 -05:00
Tim Heap 5b17dcd8ef Fixed #23883 -- Stopped flatatt modifying its argument 2014-11-21 09:45:08 +01:00
Anssi Kääriäinen d8f00e1918 Added a comment for test of refs #20278. 2014-11-20 16:26:25 -05:00
Markus Holtermann 4c709cc0ef Fixed duplicate index error on Oracle; refs #23859.
Refers to regression introduced in 7b4a994599
2014-11-20 14:42:39 -05:00
Brad Walker cfa26f29bd Reduced reduce() usage; refs #23796.
django.core.exceptions.ValidationError.messages() and
django.db.backends.schema.BaseDatabaseSchemaEditor._alter_field():
Replaced reduce(operator.add, ...) w/uncoupled, explicit sum()
2014-11-20 14:31:14 -05:00
Brad Walker f273cedc76 Added test for ValidationError.messages 2014-11-20 14:31:14 -05:00
Anssi Kääriäinen 5c481db295 Fixed #23605 -- Fixed nested subquery regression
Added relabeled_clone() method to sql.Query to fix the problem. It
manifested itself in rare cases where at least double nested subquery's
filter condition might target non-existing alias.

Thanks to Trac alias ris for reporting the problem.
2014-11-20 13:38:08 -05:00
Patryk Zawadzki 21e21c7bc2 Fixed #23844 -- Used topological sort for migration operation dependency resolution.
This removes the concept of equality between operations to guarantee
compatilibity with Python 3.

Python 3 requires equality to result in identical object hashes. It's
impossible to implement a unique hash that preserves equality as
operations such as field creation depend on being able to accept
arbitrary dicts that cannot be hashed reliably.

Thanks Klaas van Schelven for the original patch in
13d613f800.
2014-11-20 12:49:49 -05:00
Berker Peksag 788fa9fffa Fixed #12098 -- Simplified HttpRequest.__repr__(). 2014-11-20 08:45:11 -05:00
Carl Meyer 51f2de1530 Added another migration-executor test to avoid regressions. 2014-11-19 19:43:12 -07:00
Carl Meyer ab2819aa7b Fixed #23410 -- Avoided unnecessary rollbacks in related apps when migrating backwards. 2014-11-19 16:11:44 -07:00
Carl Meyer 47b7f601ee Fixed #23872 -- Removed sensitivity of migrations tests to CWD. 2014-11-19 15:03:47 -07:00
Aymeric Augustin b69b4008d1 Removed usage of a global variable. 2014-11-19 21:35:40 +01:00
Aymeric Augustin f88ad710fa Simplified caching of template context processors. 2014-11-19 21:35:39 +01:00
Aymeric Augustin a97e72aaab Simplified caching of templatetags modules. 2014-11-19 21:35:39 +01:00
Markus Holtermann 2331650835 Cleaned up and reformatted autodetector tests 2014-11-19 11:09:38 -05:00
Markus Holtermann f17acd5930 Formatted model states in autodetector tests 2014-11-19 11:09:38 -05:00
Stratos Moros cf7a2a000e Fixed #22248 -- Made RenameModel reversible 2014-11-19 14:11:35 +02:00
Tim Graham 5617508fb9 Removed nonexistent module django.test._doctest from coveragerc. 2014-11-19 06:01:39 -05:00
Anton Baklanov d63703f1cd Fixed #18714 -- Added 'fuzzy' compilemessages option 2014-11-18 22:44:16 +01:00
Tillmann Karras d188101319 Fixed #23799 -- Made makemigrations respect --no-optimize.
Thanks to yamila-moreno for the idea of a skip message.
2014-11-18 07:37:06 +01:00
Aymeric Augustin 87f187b960 Adjusted tests for previous commit.
The test was testing a use case that doesn't happen in real world
projects: developers don't assign settings at run time (and Django
explicitly doesn't support it).
2014-11-17 23:26:04 +01:00
Aymeric Augustin a37f452513 Removed superfluous newline. 2014-11-17 22:27:00 +01:00
Markus Holtermann 7b4a994599 Fixed #23859 -- Fixed a migration crash when a field is renamed that is part of an index_together 2014-11-17 19:15:07 +01:00
Ilja Maas bb4a92d784 Fixed #23840 -- Fixed makemessages find_files method
Changed the handling of extensions to be used for gettext. Now
obeying the --extension argument. find_files now only find the
given or default extensions and puts only these in the
TranslatableFiles. As a result there are no more confusing messages
for filetypes (extension) not handled by makemessages.
2014-11-17 09:21:24 +01:00
Julien Phalip 580e9d0045 Fixed a test to correctly calculate a fixture's relative path. 2014-11-17 02:32:04 +01:00
Aymeric Augustin 9eeb788cfb Refactored getting the list of template loaders.
This provides the opportunity to move utility functions specific to the
Django Template Language outside of django.template.loader.
2014-11-16 21:41:44 +01:00
Aymeric Augustin b503fee7ec Removed override_template_loaders and override_with_test_loader.
They can be replaced with override_settings and that makes the
corresponding tests much more obvious.
2014-11-16 21:40:50 +01:00
Aymeric Augustin 2577ae6a08 Moved all template loaders under django.template.loaders.
Reformatted the code of base.Loader according to modern standards.

Turned the test template loader into a regular locmem.Loader -- but
didn't document it.

Added a normal deprecation path for BaseLoader which is a public API.

Added an accelerated deprecation path for TestTemplateLoader which is
a private API.
2014-11-16 21:28:26 +01:00
Karen Tracey dec93d8991 Fixed #21612 -- Made QuerySet.update() respect to_field 2014-11-16 15:44:13 +01:00
Josh Smeaton f61256da3a Renamed qn to compiler 2014-11-16 13:19:34 +01:00
Simon Charette 68ef44c565 Removed references to the deprecated assertRaisesRegexp method. 2014-11-16 02:12:36 +01:00
Danilo Bargen 013b5eacea Added tests/README.rst 2014-11-15 19:47:05 +01:00
Berker Peksag d2d6c0c097 Fixed #21363 -- Added datetime.timedelta support to TimestampSigner.unsign(). 2014-11-15 19:36:33 +01:00
Claude Paroz 35dac5070b Added a new GeoJSON serialization format for GeoDjango
Thanks Reinout van Rees for the review.
2014-11-15 18:07:18 +01:00
Andrew Godwin c5def493d0 Fixed #23835: Changed circular dependency in DFS to be less infinite 2014-11-15 17:39:02 +01:00
Marc Tamlyn 9a5a4361c5 Merge pull request #3531 from ddaan/ticket_23834
fixed #23834 -- added test and fix to check for default null on ArrayField
2014-11-15 15:37:03 +00:00
Daan Vielen a7c58eaca4 added test and fix to check for default null on ArrayField 2014-11-15 15:20:11 +00:00
Tim Graham 83d104d61a Revert "Use topological sort for migration operation dependency resolution"
This commit broke the tests on Python 3.

This reverts commit 13d613f800.
2014-11-15 15:28:04 +01:00
Josh Smeaton f59fd15c49 Fixed #14030 -- Allowed annotations to accept all expressions 2014-11-15 14:00:43 +00:00
Klaas van Schelven 13d613f800 Use topological sort for migration operation dependency resolution
rather than an ad-hoc algorithm
2014-11-15 14:45:42 +01:00
Berker Peksag d552da1f8d Fixed #22407 -- Added AdminEmailHandler.send_mail(). 2014-11-15 09:38:19 +01:00
Michael Manfre a305695f28 Merge pull request #3481 from manfre/ticket-16358
Fixed #16358 - Made memcache backend delete old value on a failure to set.
2014-11-13 22:10:22 -05:00
Tim Graham c24a2e6cbd Fixed #23765 -- Removed BooleanField default check which often yielded false positives. 2014-11-13 20:12:29 +01:00
Adam DePue e118e3af37 Fixed #23761 -- Added test for MySQL validator and db_type is None.
The issue was fixed on master in e9103402c0
so this just forwardports the test and release notes from stable/1.7.x.

Forwardport of 2d12a59938 from stable/1.7.x
2014-11-13 11:06:59 +01:00
Tim Graham dec7da3c4c Fixed flake8 warning. 2014-11-13 10:07:44 +01:00
Sean Wang 311feae8ba Fixed #23806 -- Added a test case for settings.DISALLOWED_USER_AGENTS. 2014-11-13 09:45:14 +01:00
Michael Manfre bc8abe36ba Fixed #16358 - Made memcache backend delete old value on a failure to set.
Default Memcached configuration allows for a maximum object of 1MB and
will fail to set the key if it is too large. The key will be deleted from
memcached if it fails to be set. This is needed to avoid an issue with
cache_db session backend using the old value stored in memcached, instead
of the newer value stored in the database.
2014-11-13 00:46:03 -05:00
Baptiste Mispelon bfb11b9562 Fixed #23795 -- Fixed a regression in custom form fields
Custom form fields having a `queryset` attribute but no
`limit_choices_to` could no longer be used in ModelForms.

Refs #2445.

Thanks to artscoop for the report.
2014-11-12 22:38:18 +01:00