Commit Graph

6509 Commits

Author SHA1 Message Date
Claude Paroz cd260d03bd [1.8.x] Replaced hardcoded URLs in admin_* tests
Refs #15779. This will allow easier admin URL changes, when needed.
Thanks Simon Charette for the review.

Backport of 32e6a7d3a5 from master
2015-02-08 15:12:07 -05:00
Varun Sharma b44a56c308 [1.8.x] Fixed #24181 -- Fixed multi-char THOUSAND_SEPARATOR insertion
Report and original patch by Kay Cha.
Backport of 540ca563de from master.
2015-02-08 20:09:04 +01:00
Collin Anderson fc8e1e0c10 [1.8.x] Fixed E265 comment style
Backport of db77915c9f from master
2015-02-06 09:35:08 -05:00
Tim Graham fc1e9107d7 [1.8.x] Added UUIDField.deconstruct()
Backport of 0f54cf28c0 from master
2015-02-05 19:15:37 -05:00
Markus Holtermann c9addfd4bf [1.8.x] Fixed small regression caused by e3702dc3f2
Since 1.7 models need to declare an explicit app_label if they are not
in an application in INSTALLED_APPS or were imported before their
application was loaded.

Backport of 235124d3ea from master
2015-02-06 00:50:42 +01:00
Markus Holtermann e3702dc3f2 [1.8.x] Cleaned up schema tests
Thanks Tim Graham for the review.

Backport of 0204714b0b from master
2015-02-05 20:15:18 +01:00
Aymeric Augustin aed1b1f6e5 [1.8.x] Fixed #24265 -- Preserved template backend loading exceptions.
If importing or initializing a template backend fails, attempting to
access this template backend again must raise the same exception.

Backport of 44ad6915 from master
2015-02-05 20:09:22 +01:00
Aymeric Augustin 5fbec369aa [1.8.x] Fixed #24273 -- Allowed copying RequestContext more than once.
Thanks Collin Anderson for the report.

Backport of 31d3a355 from master
2015-02-05 14:07:18 +01:00
Matthew Somerville 2a55301f9f [1.8.x] Fixed #24242 -- Improved efficiency of utils.text.compress_sequence()
The function no longer flushes zfile after each write as doing so can
lead to the gzipped streamed content being larger than the original
content; each flush adds a 5/6 byte type 0 block. Removing this means
buf.read() may return nothing, so only yield if that has some data.
Testing shows without the flush() the buffer is being flushed every 17k
or so and compresses the same as if it had been done as a whole string.

Backport of caa3562d5b from master
2015-02-04 15:17:22 -05:00
mlavin d585ade0df [1.8.x] Fixed #24197 -- Added clearing of staticfiles caches on settings changes during tests
Cleared caching in staticfiles_storage and get_finder when
relevant settings are changed.

Backport of 2730dad0d7 from master
2015-02-04 10:54:33 -05:00
Riccardo Magliocchetti 4957b8a406 [1.8.x] Fixed #14497 -- Improved admin widget for "read only" FileFields
Based on patch by Adam J Forster, Paul Collins, and Julien.

Backport of 2be621e44c from master
2015-02-04 09:05:41 -05:00
Josh Schneier 16e3910e9c [1.8.x] Fixed typos of "select_related" in docs and tests.
Backport of 7d363ed432 from master
2015-02-04 07:32:34 -05:00
Aron Podrigal fc49e73648 [1.8.x] Fixed #15321 -- Honored ancestors unique checks.
Thanks to Tim for the review.

Backport of 79f27f2b61 from master
2015-02-03 18:58:48 -05:00
Tim Graham 3e24ab6f4c [1.8.x] Refactored tests that rely on an ImportError for Python 3.5 compatibility
A change in Python test discovery [1] causes the old packages that raised
an error to be discovered; now we use a common directory that's
ignored during discovery. Refs #23763.

[1] http://bugs.python.org/issue7559

Backport of c0cc8f69e7 from master
2015-02-03 18:31:17 -05:00
Simon Charette cbcf92e95f [1.8.x] Fixed #24266 -- Changed get_parent_list to return a list ordered by MRO.
Thanks to Aron Podrigal for the initial patch and Tim for the review.

Backport of 65e005f8cd from master
2015-02-03 16:41:51 -05:00
Tim Graham 92d5bedc56 [1.8.x] Reverted "Fixed #24146 -- Fixed a missing fields regression in admin checks."
This reverts commit e8171daf0c.

A new solution is forthcoming.

Backport of 0e489c19f1 from master
2015-02-03 15:24:24 -05:00
Claude Paroz ea3e40c278 [1.8.x] Fixed #24252 -- Forced lazy __str__ to utf-8 on Python 2
Thanks Stanislas Guerra for the report and Tomas Ehrlich for
the review.
Backport of cd0ceaa102 from master.
2015-02-03 18:26:08 +01:00
Matthew Somerville d88c24f436 [1.8.x] Fixed #24240 -- Allowed GZipping a Unicode StreamingHttpResponse
make_bytes() assumed that if the Content-Encoding header is set, then
everything had already been dealt with bytes-wise, but in a streaming
situation this was not necessarily the case.

make_bytes() is only called when necessary when working with a
StreamingHttpResponse iterable, but by that point the middleware has
added the Content-Encoding header and thus make_bytes() tried to call
bytes(value) (and dies). If it had been a normal HttpResponse,
make_bytes() would have been called when the content was set, well
before the middleware set the Content-Encoding header.

This commit removes the special casing when Content-Encoding is set,
allowing unicode strings to be encoded during the iteration before they
are e.g. gzipped. This behaviour was added a long time ago for #4969 and
it doesn't appear to be necessary any more, as everything is correctly
made into bytes at the appropriate places.

Two new tests, to show that supplying non-ASCII characters to a
StreamingHttpResponse works fine normally, and when passed through the
GZip middleware (the latter dies without the change to make_bytes()).
Removes the test with a nonsense Content-Encoding and Unicode input - if
this were to happen, it can still be encoded as bytes fine.

Backport of 250aa7c39b from master.
2015-02-03 18:19:06 +01:00
Anssi Kääriäinen 43b0131fb5 [1.8.x] Fixed #23617 -- Added get_pk_value_on_save()
The method is mainly intended for use with UUIDField. For UUIDField we
want to call the field's default even when primary key value is
explicitly set to None to match the behavior of AutoField.

Thanks to Marc Tamlyn and Tim Graham for review.

Backport of 8adc59038c from master
2015-02-03 09:25:55 -05:00
Tim Graham 9ffe013caa [1.8.x] Fixed #24263 -- Prevented extra queries on BaseDateDetailView with a custom queryset.
Thanks jekka-ua for the report and patch.

Backport of 118b11221f from master
2015-02-03 09:13:10 -05:00
Aymeric Augustin f87457a460 [1.8.x] Fixed #24168 -- Allowed selecting a template engine in a few APIs.
Specifically in rendering shortcuts, template responses, and class-based
views that return template responses.

Also added a test for render_to_response(status=...) which was missing
from fdbfc980.

Thanks Tim and Carl for the review.

Backport of 2133f31 from master.

Conflicts:
	docs/topics/http/shortcuts.txt
	tests/generic_views/test_base.py
2015-02-03 08:32:14 +01:00
Tim Graham fe770a6452 [1.8.x] Fixed expressions test on Python 3.5; refs #23763.
Backport of 62df1834b8 from master
2015-02-01 20:11:40 -05:00
Tim Graham c9e538b174 [1.8.x] Removed threading fallback imports.
Django imports threading in many other places without fallback.

Backport of 18f3e79b13 from master
2015-02-01 18:45:01 -05:00
Tim Graham 7060ef7158 [1.8.x] Reverted "Fixed #6785 -- Made QuerySet.get() fetch a limited number of rows."
This reverts commit da79ccca1d.

This optimized the unsuccessful case at the expense of the successful one.

Backport of 293fd5da5b from master
2015-01-30 12:52:39 -05:00
Simon Charette a301061f88 [1.8.x] Fixed #23940 -- Allowed model fields to be named `exact`.
An explicit `__exact` lookup in the related managers filters
was interpreted as a reference to a foreign `exact` field.

Thanks to Trac alias zhiyajun11 for the report, Josh for the investigation,
Loïc for the test name and Tim for the review.

Backport of eb4cdfbdd6 from master
2015-01-29 14:42:28 -05:00
Josh Smeaton 6c68e40e6e [1.8.x] Refs #14030 -- Added repr methods to all expressions
Backport of 7171bf755b from master
2015-01-28 11:03:39 +11:00
Josh Smeaton 405351ba2f [1.8.x] Refs #24060 -- Added a test demonstrating reverse order isn't mutable
Backport of f218a2ff45 from master
2015-01-28 11:03:25 +11:00
Raul Cumplido 7cc1b4710e [1.8.x] Fixed #24209 -- Prevented crash when parsing malformed RFC 2231 headers
Thanks Tom Christie for the report and review.
Backport of ac650d02cb from master.
2015-01-27 20:16:53 +01:00
Josh Smeaton e56810e839 [1.8.x] Fixed #24154 -- Backends can now check support for expressions
Backport of 8196e4bdf4 from master
2015-01-27 14:47:38 +11:00
Tomáš Ehrlich 5dff3513cc [1.8.x] Fixed #24220 - Allowed lazy objects for success_url
Backport of 511be35779 from master
2015-01-26 12:42:08 -05:00
Tim Graham 242c9538c8 [1.8.x] Fixed test_runner test failure on Python 3.5; refs #23763.
Python change is http://bugs.python.org/issue22032

Backport of 0386b97706 from master
2015-01-23 16:42:33 -05:00
Ng Zhi An 56015c01c4 [1.8.x] Fixed #24170 -- Implemented decompress for BaseRangeField widgets
Backport of 4669b6a807 from master
2015-01-23 15:07:03 -05:00
Claude Paroz bc93568500 [1.8.x] Fixed warning leak in static.serve() test
Partial forward port of b1bf8d64fb from 1.7.x. Refs #24193.
2015-01-23 09:05:46 +01:00
Andriy Sokolovskiy 11a5e45b96 [1.8.x] Fixed #24104 -- Fixed check to look on field.many_to_many instead of class instance
Backport of 38c17871bb from master
2015-01-22 18:53:47 +01:00
Loic Bistuer 0580133971 [1.8.x] Fixed small inconsistency when handling aggregate's default_alias.
Refs #14030.

Backport of d450af8a26 from master
2015-01-22 08:02:07 +07:00
Adam Taylor 45aaced91e [1.8.x] Fixed typos in code comments.
Backport of 039465a6a7 from master
2015-01-20 12:18:29 -05:00
Markus Holtermann 20f1aafa14 [1.8.x] Refs #24163 -- Fixed failing Oracle test when migrating from ForeignKey to OneToOneField
Thanks Tim Graham for review

Backport of 64ecb3f07d from master
2015-01-20 17:45:29 +01:00
Marc Tamlyn c80b2144d2 [1.8.x] Fixes #24169 -- More arrayfield specific lookups.
varchar()[] cannot compare itself to text[]

Thanks to joelburton for the patch.

Backport of 0ae94d0d31 from master
2015-01-20 10:26:32 +00:00
Josh Smeaton 504cd5d3be [1.8.x] Fixed #24183 -- Fixed wrong comparisons in Substr
Backport of 61c102d010 from master
2015-01-20 12:11:27 +11:00
Tim Graham 06fa019c1b [1.8.x] Fixed #24153 -- Fixed cookie test compatibility with Python 3.4.3+
Backport of b19b81b396 from master
2015-01-19 15:39:36 -05:00
Markus Holtermann e55cb91bd4 [1.8.x] Fixed #24163 -- Removed unique constraint after index on MySQL
Thanks Łukasz Harasimowicz for the report.

Backport of 5792e6a88c from master
2015-01-19 16:55:25 +01:00
Josh Smeaton 0c910823c1 [1.8.x] Fixed #24174 -- Fixed extra order by descending
Backport of 69c6a6868f from master
2015-01-19 13:18:09 +11:00
Tim Graham 663db8ea2a [1.8.x] Removed usage of deprecated removetags in a template test.
Backport of b84100e8e2 from master
2015-01-18 18:33:56 -05:00
Markus Holtermann 5512338d4f [1.8.x] Cleaned up migration writer tests
Backport of 65d55c4093 from master
2015-01-17 20:42:58 +01:00
Marc Tamlyn 39d95fb6ad Fixed #24092 -- Widened base field support for ArrayField.
Several issues resolved here, following from a report that a base_field
of GenericIpAddressField was failing.

We were using get_prep_value instead of get_db_prep_value in ArrayField
which was bypassing any extra modifications to the value being made in
the base field's get_db_prep_value. Changing this broke datetime
support, so the postgres backend has gained the relevant operation
methods to send dates/times/datetimes directly to the db backend instead
of casting them to strings. Similarly, a new database feature has been
added allowing the uuid to be passed directly to the backend, as we do
with timedeltas.

On the other side, psycopg2 expects an Inet() instance for IP address
fields, so we add a value_to_db_ipaddress method to wrap the strings on
postgres. We also have to manually add a database adapter to psycopg2,
as we do not wish to use the built in adapter which would turn
everything into Inet() instances.

Thanks to smclenithan for the report.
2015-01-16 16:15:16 -05:00
Collin Anderson e8171daf0c Fixed #24146 -- Fixed a missing fields regression in admin checks.
This allows using get_field() early in the app loading process.

Thanks to PirosB3 and Tim Graham.
2015-01-16 14:47:09 -05:00
Claude Paroz b4ac232907 Fixed #24099 -- Removed contenttype.name deprecated field
This finsishes the work started on #16803.
Thanks Simon Charette, Tim Graham and Collin Anderson for the
reviews.
2015-01-16 20:21:34 +01:00
Collin Anderson 5338ff4808 Fixed #24160 -- Fixed model_regress test on Windows; refs #24007. 2015-01-16 11:59:08 -05:00
Tim Graham 28db4af80a Fixed #24135 -- Made RenameModel rename many-to-many tables.
Thanks Simon and Markus for reviews.
2015-01-15 20:34:33 -05:00
Yang Liu 3f9ec12d9c Fixed #23712 -- Fixed KeyError with BaseForm._html_output() 2015-01-15 20:19:53 -05:00
Collin Anderson faf0d66a80 Fixed #23850 -- Fixed a migrations test failure on Mac OS X & Python 3 2015-01-15 19:45:43 -05:00
Michał Modzelewski 39b58ad95a Fixed #24148 -- Documented a bug with case expressions in SQLite < 3.7.0 2015-01-15 19:42:05 -05:00
Collin Anderson 67dbc56ec8 Made an expressions_case test work without Pillow. 2015-01-15 14:02:58 -05:00
Tim Graham 9801d419b9 Skipped a problematic file_storage test on Windows. 2015-01-14 15:00:27 -05:00
Collin Anderson 2d5da57f48 Fixed incorrect error message in Options.get_fields() 2015-01-14 14:51:05 -05:00
Tim Graham 28308078f3 Fixed #22603 -- Reorganized classes in django.db.backends. 2015-01-14 14:16:20 -05:00
Tim Graham a6f144fd4f Fixed a static view test on Windows. 2015-01-14 13:56:49 -05:00
Markus Holtermann 88786afbff Fixed #24147 -- Prevented managers leaking model during migrations
Thanks Tim Graham for the review.
2015-01-14 16:09:33 +01:00
Tim Graham baf2542c4f Fixed DoS possibility in ModelMultipleChoiceField.
This is a security fix. Disclosure following shortly.

Thanks Keryn Knight for the report and initial patch.
2015-01-13 13:03:06 -05:00
Tim Graham a3bebfdc34 Ensured views.static.serve() doesn't use large memory on large files.
This issue was fixed in master by refs #24072.
2015-01-13 13:03:06 -05:00
Tim Graham 69b5e66738 Fixed is_safe_url() to handle leading whitespace.
This is a security fix. Disclosure following shortly.
2015-01-13 13:03:06 -05:00
Carl Meyer 316b8d4974 Stripped headers containing underscores to prevent spoofing in WSGI environ.
This is a security fix. Disclosure following shortly.

Thanks to Jedediah Smith for the report.
2015-01-13 13:03:05 -05:00
Michał Modzelewski 65246de7b1 Fixed #24031 -- Added CASE expressions to the ORM. 2015-01-12 18:15:34 -05:00
Josh Smeaton 21b858cb67 Fixed #24060 -- Added OrderBy Expressions 2015-01-13 09:39:55 +11:00
Claude Paroz f48e2258a9 Fixed #24133 -- Replaced formatting syntax in success_url placeholders
Thanks Laurent Payot for the report, and Markus Holtermann, Tim Graham
for the reviews.
2015-01-12 22:51:22 +01:00
Aymeric Augustin 5f7230e12f Fixed #24124 (again) -- Updated tests with new default context_processors.
Thanks Collin for the review.
2015-01-12 22:31:44 +01:00
Aymeric Augustin 6b5113ec94 Made debug views not crash when there isn't a default template engine. 2015-01-12 21:01:34 +01:00
Aymeric Augustin 79deb6a071 Accounted for multiple template engines in template responses. 2015-01-12 21:01:34 +01:00
Aymeric Augustin a3e783fe11 Deprecated passing a Context to a generic Template.render.
A deprecation path is required because the return type of
django.template.loader.get_template changed during the
multiple template engines refactor.

test_csrf_token_in_404 was incorrect: it tested the case when the
hardcoded template was rendered, and that template doesn't depend on the
CSRF token. This commit makes it test the case when a custom template is
rendered.
2015-01-12 21:01:34 +01:00
Aymeric Augustin 71b7668b75 Rewrapped TemplateSyntaxError in Jinja2 backend.
Changed import style to avoid confusion between Django's and Jinja2's
APIs.
2015-01-12 21:01:34 +01:00
Claude Paroz 4c413e231c Fixed #17785 -- Preferred column names in get_relations introspection
Thanks Thomas Güttler for the report and the initial patch, and
Tim Graham for the review.
2015-01-12 19:58:47 +01:00
Muthiah Annamalai b75c707943 Fixed #24089 -- Added check for when ModelAdmin.fieldsets[1]['fields'] isn't a list/tuple. 2015-01-12 13:47:58 -05:00
Markus Holtermann eeb88123e7 Fixed #24129 -- Added indicator that migrations are rendering the initial state
Thanks Tim Graham for the review.
2015-01-12 19:23:46 +01:00
Tim Graham 9f51d0c86d Fixed test from refs #23913 when running tests in reverse. 2015-01-12 13:20:44 -05:00
Markus Holtermann bbbed99f62 Fixed #24123 -- Used all available migrations to generate the initial migration state
Thanks Collin Anderson for the input when creating the patch and Tim Graham for the review.
2015-01-12 18:39:18 +01:00
Pavel Shpilev a7c256cb54 Fixed #9893 -- Allowed using a field's max_length in the Storage. 2015-01-12 09:09:18 -05:00
Marc Tamlyn b5c1a85b50 Fixed #24118 -- Added --debug-sql option for tests.
Added a --debug-sql option for tests and runtests.py which outputs the
SQL logger for failing tests. When combined with --verbosity=2, it also
outputs the SQL for passing tests.

Thanks to Berker, Tim, Markus, Shai, Josh and Anssi for review and
discussion.
2015-01-12 08:16:08 +00:00
Claude Paroz 68a439a18d Removed supports_binary_field flag as all backends support them
It was mainly for MySQL on Python 3, but now the current
recommended MySQL driver for Python 3 (mysqlclient) does support
binary fields, it is unneeded. Refs #20377.
2015-01-11 23:34:47 +01:00
Ola Sitarska d563e3be68 Fixed #23913 -- Deprecated the `=` comparison in `if` template tag. 2015-01-11 15:21:01 -05:00
Claude Paroz 412066e71e Revert "Marked a test as an expected failure on MySQL and Python 3.2."
This reverts commit 832b4a5722.
We officially don't support MySQL on Python 3.2. Refs #20380.
2015-01-11 20:59:07 +01:00
Markus Holtermann fdc2cc9487 Fixed #24110 -- Rewrote migration unapply to preserve intermediate states 2015-01-10 23:14:15 +01:00
Simon Charette 07988744b3 Fixed #13165 -- Added edit and delete links to admin foreign key widgets.
Thanks to Collin Anderson for the review and suggestions and Tim for the
final review.
2015-01-10 12:24:52 -05:00
Marc Tamlyn 48ad288679 Fixed #24001 -- Added range fields for PostgreSQL.
Added support for PostgreSQL range types to contrib.postgres.

- 5 new model fields
- 4 new form fields
- New validators
- Uses psycopg2's range type implementation in python
2015-01-10 16:18:19 +00:00
Claude Paroz 7289d01973 Introspected alternate SQLite FK definitions 2015-01-10 16:51:14 +01:00
Claude Paroz ffca9b49d4 Updated introspection test to use skipUnlessDBFeature 2015-01-10 15:42:31 +01:00
Claude Paroz d7bc37d611 Fixed #24097 -- Prevented AttributeError in redirect_to_login
Thanks Peter Schmidt for the report and the initial patch.
Thanks to ​Oktay Sancak for writing the original failing test and
Alvin Savoy for supporting contributing back to the community.
2015-01-10 10:05:02 +01:00
Loic Bistuer 8f4877c89d Fixed #22583 -- Allowed RunPython and RunSQL to provide hints to the db router.
Thanks Markus Holtermann and Tim Graham for the review.
2015-01-10 00:30:48 +07:00
Preston Timmons 665e0aa6ec Fixed #24094 -- Enabled template tests to run individually. 2015-01-09 11:43:59 -05:00
Markus Holtermann c8bac4b556 Fixed #24098 -- Added no-op attributes to RunPython and RunSQL
Thanks Loïc Bistuer and Tim Graham for the discussion and review.
2015-01-09 10:31:32 -05:00
Anssi Kääriäinen 0c7633178f Fixed #24020 -- Refactored SQL compiler to use expressions
Refactored compiler SELECT, GROUP BY and ORDER BY generation.
While there, also refactored select_related() implementation
(get_cached_row() and get_klass_info() are now gone!).

Made get_db_converters() method work on expressions instead of
internal_type. This allows the backend converters to target
specific expressions if need be.

Added query.context, this can be used to set per-query state.

Also changed the signature of database converters. They now accept
context as an argument.
2015-01-08 14:07:54 -05:00
Tim Graham b8abfe141b Fixed #24101 -- Fixed flaky admin_views selenium tests; refs #7361. 2015-01-08 13:17:00 -05:00
Tim Graham 5c43fd4825 Isolated some cache tests; refs #23947.
This reverts a change made in 40c60efecc
which was incorrect and caused CacheKeyWarnings.
2015-01-08 13:14:45 -05:00
Claude Paroz 543df07720 Fixed #24073 -- Returned None for get_language when translations are deactivated
This fixes a regression caused by f7c287fca9. Thanks Markus Holtermann
for identifying the regression.
2015-01-08 17:43:07 +01:00
Tim Graham ade9859996 Fixed #24095 -- Prevented WarningLoggerTests from leaking a warnings filter. 2015-01-08 08:49:54 -05:00
Markus Holtermann 862ea825b5 Fixed #24093 -- Prevented MigrationWriter to write operation kwargs that are not explicitly deconstructed 2015-01-07 17:29:20 -07:00
Tim Graham f487a3275e Avoided a deprecated alias on Python 3 in file_uploads test. 2015-01-07 19:12:37 -05:00
Josh Smeaton 8713ea7568 Fixed null handling in Value expression 2015-01-07 19:07:49 -05:00
Markus Holtermann 1f03d2d924 Refs #23822 -- Made MigrationOptimizer aware of model managers 2015-01-07 17:33:04 -05:00
Aymeric Augustin 127f9e073d Restored support for multiple template names in render(_to_response).
This possibility was documented but not tested.

It had been broken during the multiple template engines refactor.
2015-01-07 21:54:22 +01:00
Aymeric Augustin eaa1a22341 Added a request argument to render_to_string.
This is for consistency with Template.render.

It adds a little bit of knowledge about HTTP requests in
django.template.loader but I think consistency trumps purity.
2015-01-07 21:54:22 +01:00
Claude Paroz f7c287fca9 Fixed #24073 -- Deactivated translations when leave_locale_alone is False
Thanks Tim Graham and Markus Holtermann for the reviews.
2015-01-07 20:11:24 +01:00
Michał Modzelewski ee86e59051 Refs #2443 -- Allowed creation of objects with NULL DurationFields 2015-01-07 08:33:26 -05:00
Josh Smeaton 5a4ac4ead9 Fixed #24078 -- Removed empty strings from GenericIPAddressField 2015-01-07 08:08:36 -05:00
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Tim Graham 749d23251b Removed warning handling that should have been removed in refs #23891. 2015-01-06 18:33:55 -05:00
Aymeric Augustin 0cdb09d489 Made context take priority over context processors.
This is the expected behavior, but given RequestContext's tortuous
implementation, a straightforward use of its API results in the
opposite.

This commits fixes a regression that must have happened at different
points in the multiple templates engine refactor for different features.
2015-01-06 22:02:27 +01:00
Danilo Bargen 2e65d56156 Fixed #20003 -- Improved and extended URLValidator
This adds support for authentication data (`user:password`) in URLs,
IPv6 addresses, and unicode domains.

The test suite has been improved by adding test URLs from
http://mathiasbynens.be/demo/url-regex (with a few adjustments,
like allowing local and reserved IPs).

The previous URL validation regex failed this test suite on 13
occasions, the validator was updated based on
https://gist.github.com/dperini/729294.
2015-01-06 14:04:25 -05:00
Claude Paroz 011f21b4fa Used None-related assertions in CSRF tests
Thanks Markus Holtermann for spotting this.
2015-01-06 08:48:01 +01:00
Claude Paroz 27dd7e7271 Fixed #23815 -- Prevented UnicodeDecodeError in CSRF middleware
Thanks codeitloadit for the report, living180 for investigations
and Tim Graham for the review.
2015-01-06 08:42:58 +01:00
Preston Timmons de9ebdd39c Fixed #24022 -- Deprecated the ssi tag. 2015-01-05 19:35:02 -05:00
Markus Holtermann e08318b4ef Refs #23359 -- Removed double newline from output of migrate --list
Thanks Berker Peksag for the review.
2015-01-05 14:52:54 -05:00
Tim Graham 789baf9c3a Fixed test failures introduced in refs #23861. 2015-01-05 14:35:30 -05:00
Tim Graham c87ee41954 Fixed #23861 -- Added an API to deprecate model fields.
Thanks Markus Holterman and Berker Peksag for review.
2015-01-05 11:35:36 -05:00
Claude Paroz 6e1c9c6568 Fixed #8280 -- Allowed management command discovery for eggs
Thanks jdetaeye for the report, bhuztez and jdetaeye for the
initial patches, Tim Graham and Berker Peksag for the reviews.
2015-01-05 17:19:35 +01:00
Collin Anderson 3d2cae0896 Fixed #24072 -- Added FileResponse for streaming binary files. 2015-01-05 10:51:52 -05:00
Andriy Sokolovskiy 23f1a8dad2 Added return value to Signal.disconnect(). 2015-01-02 12:00:41 -05:00
Tim Graham 937fab030d Renamed an assertion in the dispatch tests. 2015-01-02 11:29:06 -05:00
Daniel Pyrathon 8958170755 Fixed #9104 -- Moved FieldDoesNotExist to core.exceptions 2015-01-02 10:46:04 -05:00
Claude Paroz 1aa3e09c20 Fixed #23745 -- Reused states as much as possible in migrations
Thanks Tim Graham and Markus Holtermann for the reviews.
2015-01-02 15:37:10 +01:00
Claude Paroz 2a9c4b4901 Passed around the state between migrations
Refs #23745.
2015-01-02 15:37:10 +01:00
Claude Paroz a159b1facd Replaced migration state render() by apps cached property
Refs #23745.
2015-01-02 15:19:36 +01:00
Tim Graham 40ccef16cb Silenced an ImportWarning in the template_backends tests. 2015-01-01 14:28:53 -05:00
Tim Graham b9feec959b Fixed #23700 -- Fixed non-deterministic static files test failures on Windows.
This partially reverts commit 949ee521fa
refs #21230.
2015-01-01 13:57:52 -05:00
Tim Graham 40a8504357 Fixed #23891 -- Moved deprecation of IPAddressField to system check framework.
Thanks Markus Holtermann for review.
2015-01-01 13:30:52 -05:00
Thomas Tanner 46068d850d Fixed #22295 -- Replaced permission check for displaying admin user-tools 2014-12-31 16:31:59 -05:00
Andrey Maslov 7a878ca5cb Fixed #24008 -- Fixed ValidationError crash with list of dicts. 2014-12-31 14:43:13 -05:00
Markus Holtermann a1487deebf Fixed #23359 -- Added showmigrations command to list migrations and plan.
Thanks to Collin Anderson, Tim Graham, Gabe Jackson, and Marc Tamlyn
for their input, ideas, and review.
2014-12-31 14:14:28 -05:00
Will Earp 8952757698 Refs #18586 -- Split up tests.defer.DeferTests.test_defer 2014-12-31 11:56:06 -05:00
Tim Graham 8a9b0c15a6 Renamed tests for util -> utils moves; refs #17627. 2014-12-31 11:26:27 -05:00
Tim Graham 837fc2d8cd Fixed a queries test on Python 2 broken after importing six.moves.range(). 2014-12-31 09:50:47 -05:00
Tim Graham 63dee96cc7 Fixed test from refs #23758. 2014-12-31 09:19:04 -05:00
Piotr Pawlaczek 41fc1c0b5e Fixed #23758 -- Allowed more than 5 levels of subqueries
Refactored bump_prefix() to avoid infinite loop and allow more than
than 5 subquires by extending the alphabet to use multi-letters.
2014-12-31 08:48:28 -05:00
Tim Graham 93d73dac91 Moved DatabaseCreation.data_types properties to DatabaseWrapper.
refs #22340.
2014-12-31 08:29:17 -05:00
Berker Peksag 32ca159c96 Ignored warnings correctly in test_get_formsets_with_inlines_returns_tuples().
The subclass check in ModelAdmin.get_formsets_with_inlines() wasn't
tested correctly because of the super() call in
EpisodeAdmin.get_formsets().
2014-12-31 08:24:09 -05:00
Claude Paroz 51890ce889 Applied ignore_warnings to Django tests 2014-12-30 18:16:25 +01:00
Tim Graham df3cc53fda Fixed #23450 -- Fixed transient failure of requests...test_far_expiration. 2014-12-30 10:23:42 -05:00
Tim Graham c6b12bc995 Removed unused import. 2014-12-30 10:23:29 -05:00
Andriy Sokolovskiy 8c99b7920e Fixed #12118 -- Added shared cache support to SQLite in-memory testing. 2014-12-30 10:14:33 -05:00
Markus Holtermann fca866763a Added test for an intermediate swappable model change in migration state.
refs #22563
2014-12-30 10:01:25 -05:00
Tim Graham ab4f709da4 Fixed #23581 -- Prevented extraneous DROP DEFAULT statements.
Thanks john_scott for the report and Markus Holtermann for review.
2014-12-30 07:54:05 -05:00
Markus Holtermann 623ccdd598 Fixed #23938 -- Added migration support for m2m to concrete fields and vice versa
Thanks to Michael D. Hoyle for the report and Tim Graham for the review.
2014-12-29 13:41:12 -05:00
Claude Paroz 3c5d1edb39 Fixed #22279 -- Prevented dummy backend going through DatabaseErrorWrapper
Thanks Daniel Hahler for the report and Tim Graham for the review.
2014-12-29 19:06:28 +01:00
Claude Paroz 1d24f073e6 Fixed #21255 -- Closed connections after management command ran
Thanks kabakov.as@gmail.com for the report, and Aymeric Augustin,
Simon Charette for the reviews.
2014-12-29 19:02:45 +01:00
Berker Peksag bae404dea3 Converted middleware tests to use RequestFactory. 2014-12-29 19:36:18 +02:00
Ramiro Morales 6fb9dee470 Fixed #23271 -- Don't corrupt PO files on Windows when updating them.
Make sure PO catalog text fetched from gettext programs via standard
output isn't corrupted by mismatch between assumed (UTF-8) and real
(CP1252) encodings. This can cause mojibake to be written when creating
or updating PO files.

Also fixes #23311.

Thanks to contributor with Trac nick 'danielmenzel' for the report,
excellent research and fix.
2014-12-29 12:24:50 -03:00
Josh Smeaton 1cdfbde4db Fixed #23753 -- Oracle failure with Coalesce 2014-12-29 19:44:13 +11:00
Aymeric Augustin b7282db833 Raised a warning when using the legacy TEMPLATE_* settings.
All tests now rely on TEMPLATES.
2014-12-28 17:02:31 +01:00
Aymeric Augustin 9eb4f28e89 Deprecated TEMPLATE_CONTEXT_PROCESSORS. 2014-12-28 17:02:31 +01:00
Aymeric Augustin d3205e3e2e Deprecated TEMPLATE_DIRS. 2014-12-28 17:02:30 +01:00
Aymeric Augustin cf0fd65ed4 Deprecated TEMPLATE_LOADERS. 2014-12-28 17:02:30 +01:00
Aymeric Augustin d3a982556d Deprecated TEMPLATE_STRING_IF_INVALID. 2014-12-28 17:02:30 +01:00
Aymeric Augustin 3dc01aaaaf Deprecated ALLOWED_INCLUDE_ROOTS. 2014-12-28 17:02:30 +01:00
Aymeric Augustin cf1f36bb6e Deprecated current_app in TemplateResponse and render(_to_response). 2014-12-28 17:02:29 +01:00
Aymeric Augustin fdbfc98003 Deprecated some arguments of django.shortcuts.render(_to_response).
dictionary and context_instance and superseded by context.

Refactored tests that relied context_instance with more modern idioms.
2014-12-28 17:02:29 +01:00
Aymeric Augustin 92e8f1f302 Moved context_processors from django.core to django.template. 2014-12-28 17:00:07 +01:00
Aymeric Augustin 969e082858 Added tests for django.template.loader.
Deprecated features aren't tested.
2014-12-28 17:00:07 +01:00
Aymeric Augustin 90805b240f Supported multiple template engines in render_to_string.
Adjusted its API through a deprecation path according to the DEP.
2014-12-28 16:23:02 +01:00
Aymeric Augustin 5523e4cdbb Removed private API find_template.
It wasn't documented and it wasn't used anywhere, except in a few tests
that don't test it specifically and can be rewritten with get_template.
2014-12-28 16:23:01 +01:00
Aymeric Augustin 4ea43ac915 Supported multiple template engines in get_template and select_template.
This commit changes the return type of these two functions. Instead of
returning a django.template.Template they return a backend-specific
Template class that must implement render(self, context).
2014-12-28 16:23:01 +01:00
Aymeric Augustin 92a2d049a2 Isolated template tests from Django settings. 2014-12-28 16:23:01 +01:00
Aymeric Augustin 332154e726 Added basic tests for template backends. 2014-12-28 16:23:00 +01:00
Aymeric Augustin 7eefdbf7ab Cleaned up the django.template namespace.
Since this package is going to hold both the implementation of the Django
Template Language and the infrastructure for Multiple Template Engines,
it should be untied from the DTL as much as possible within our
backwards-compatibility policy.

Only public APIs (i.e. APIs mentioned in the documentation) were left.
2014-12-28 14:47:31 +01:00
Aymeric Augustin 6d52f6f8e6 Fixed #23831 -- Supported strings escaped by third-party libs in Django.
Refs #7261 -- Made strings escaped by Django usable in third-party libs.

The changes in mark_safe and mark_for_escaping are straightforward. The
more tricky part is to handle correctly objects that implement __html__.

Historically escape() has escaped SafeData. Even if that doesn't seem a
good behavior, changing it would create security concerns. Therefore
support for __html__() was only added to conditional_escape() where this
concern doesn't exist.

Then using conditional_escape() instead of escape() in the Django
template engine makes it understand data escaped by other libraries.

Template filter |escape accounts for __html__() when it's available.
|force_escape forces the use of Django's HTML escaping implementation.

Here's why the change in render_value_in_context() is safe. Before Django
1.7 conditional_escape() was implemented as follows:

    if isinstance(text, SafeData):
        return text
    else:
        return escape(text)

render_value_in_context() never called escape() on SafeData. Therefore
replacing escape() with conditional_escape() doesn't change the
autoescaping logic as it was originally intended.

This change should be backported to Django 1.7 because it corrects a
feature added in Django 1.7.

Thanks mitsuhiko for the report.
2014-12-27 18:02:34 +01:00
Aymeric Augustin 5c5eb5fea4 Fixed an inconsistency introduced in 547b1810.
mark_safe and mark_for_escaping should have been kept similar.

On Python 2 this change has no effect. On Python 3 it fixes the use case
shown in the regression test for mark_for_escaping, which used to raise
a TypeError. The regression test for mark_safe is just for completeness.
2014-12-27 17:44:54 +01:00
Claude Paroz 2ceb10f3b0 Fixed #14180 -- Prevented unneeded index creation on MySQL-InnoDB
Thanks zimnyx for the report and Simon Charette, Tim Graham for
the reviews.
2014-12-27 12:52:44 +01:00
Josh Smeaton 4718296546 Fixed #23753 -- Added a suite of SQL Functions
Added functions and tests
Added docs and more tests
Added TextField converter to mysql backend
Aliased Value as V in example docs and tests
Removed unicode_compatible in example
Fixed console emulation in examples
2014-12-27 15:27:27 +11:00
Tim Graham 7c07612e90 Removed an unnecessary models file in the admin_scripts tests. 2014-12-26 19:31:54 -05:00
Tim Graham 75bbcfa332 Replaced sqlall in some bash_completion/admin_scripts tests.
sqlall will be removed in Django 1.9, so now's a good time to remove
its usage where it's not important.
2014-12-26 18:52:26 -05:00
Gavin Wahl b4e76f30d1 Fixed #23346 -- Fixed lazy() to lookup methods on the real object, not resultclasses.
Co-Authored-By: Rocky Meza <rmeza@fusionbox.com>
2014-12-26 11:30:34 -05:00
Niclas Olofsson 3daa9d60be Fixed #10414 -- Made select_related() fail on invalid field names. 2014-12-24 14:54:30 -05:00
Thomas Tanner b27db97b23 Fixed #22461 -- Added if-unmodified-since support to the condition decorator. 2014-12-24 12:33:57 -05:00
Claude Paroz fae551d765 Complemented pickle test for ValuesQuerySet with related field
Refs #14515.
2014-12-24 14:58:32 +01:00
Claude Paroz 7ce9644d93 Added a test to ensure bad assignation to M2M doesn't clear data
Refs #14394.
2014-12-24 14:18:00 +01:00
Tim Graham c5c235cd4f Fixed typo in test_utils comment. 2014-12-24 07:10:34 -05:00
Claude Paroz b3ebcb22a9 Ignored deprecation warnings for CreationIndexesTests 2014-12-24 10:45:53 +01:00
Claude Paroz 9699d8446e Moved test correction from 5b1fb0a75 2014-12-24 10:42:24 +01:00
Tim Graham 061caa5b38 Fixed #24037 -- Prevented data loss possibility when changing Meta.managed.
The migrations autodetector now issues AlterModelOptions operations for
Meta.managed changes instead of DeleteModel + CreateModel.

Thanks iambibhas for the report and Simon and Markus for review.
2014-12-23 14:25:31 -05:00
Claude Paroz 30cbd5d360 Replaced DatabaseCreation sql methods by schema editor equivalents
Also used schema editor in migrate to sync unmigrated apps (sync_apps).
Refs #22340. Thanks Tim Graham for the review.
2014-12-23 19:35:01 +01:00
Claude Paroz 15ba0d166f Added migration for site test app depending on contrib.sites 2014-12-23 19:01:33 +01:00
Claude Paroz 750dbb1133 Removed unneeded null param to ManyToManyField 2014-12-23 19:01:03 +01:00
Claude Paroz 90720d549a Removed admin_util test dependency on contrib.sites 2014-12-23 18:43:55 +01:00
Claude Paroz f05b03f3d7 Removed model_package test dependency on contrib.sites 2014-12-23 18:10:07 +01:00
Anssi Kääriäinen f233bf47dd Fixed #21414 -- Removed RelatedObject and deprecated Field.related. 2014-12-23 10:54:25 -05:00
Claude Paroz 9fecb86a52 Fixed #17946 -- Fixed deserialization of self-referencing M2M fields
Thanks Philip Mountifield for the report and excellent analysis, and
Simon Charette for the review.
2014-12-23 16:01:39 +01:00
Thomas Chaumeny 994d6137a2 Fixed #23792 -- Added test.utils.freeze_time() context manager. 2014-12-22 07:46:40 -05:00
Oscar Ramirez 54085b0f9b Fixed #23998 -- Added datetime.time support to migrations questioner. 2014-12-22 07:24:54 -05:00
Marc Tamlyn 936e87c97b Merge pull request #3765 from wlanslovenija/ticket_24034
Fixed #24034 -- Don't always overwrite deconstruct path.
2014-12-22 00:41:13 +00:00
Josh Schneier 9a23470072 Fixed #24017 -- Added python_2_unicode_compatible in db/migrations 2014-12-21 16:10:43 -05:00
Jernej Kos 7c50e7eecc Fixed #24034 -- Don't always overwrite deconstruct path.
Made deconstruct path overwriting for ArrayField conditional,
so it only occurs when the deconstructed field is an instance
of ArrayField itself and not a subclass.
2014-12-21 17:31:50 +01:00
Marc Tamlyn 57554442fe Fixed #2443 -- Added DurationField.
A field for storing periods of time - modeled in Python by timedelta. It
is stored in the native interval data type on PostgreSQL and as a bigint
of microseconds on other backends.

Also includes significant changes to the internals of time related maths
in expressions, including the removal of DateModifierNode.

Thanks to Tim and Josh in particular for reviews.
2014-12-20 18:28:29 +00:00
Tim Graham 995be4a137 Fixed refs #24007 test on Windows. 2014-12-19 14:11:17 -05:00
Claude Paroz 1d9fc5caa9 Made model_regress unpickling test CWD-independent
Refs #24007. Thanks Tim Graham for his help with the patch.
2014-12-19 18:37:32 +01:00
Claude Paroz 5b1fb0a75d Forward-ported test and release note from f46a16614
Refs #24015.
2014-12-18 21:17:17 +01:00
Claude Paroz 9bcd4d812c Fixed #23788 (2) -- Improved gettext version checker
Thanks Tim Graham for the report and initial patch.
2014-12-18 16:06:33 +01:00
Collin Anderson 4fb38b7307 Allowed Python executable names other than python in test from refs #24007. 2014-12-17 20:09:24 -05:00
Claude Paroz 108b8bf852 Fixed #24007 -- Ensure apps registry's ready before unpickling models
This prevents AppRegistryNotReady errors when unpickling Django
models from an external script.
2014-12-17 18:33:32 +01:00
Mosson, Andrew b7219c7ba5 Fixed #23497 -- Made admin system checks run for custom AdminSites. 2014-12-17 09:11:46 -05:00
Anssi Kääriäinen 1c5cbf5e5d Fixed #24002 -- GenericRelation filtering targets related model's pk
Previously Publisher.objects.filter(book=val) would target
book.object_id if book is a GenericRelation. This is inconsistent to
filtering over reverse foreign key relations, where the target is the
related model's primary key.
2014-12-17 10:04:52 +02:00
Tim Graham d2ff8a7241 Fixed #23975 -- Restored pre_migrate signal if all apps have migrations.
Thanks kmmbvnr for the report.
2014-12-16 18:34:25 -05:00
Preston Timmons f91d7366e0 Fixed #16028 -- Moved defaultfilters tests into template_tests. 2014-12-16 14:45:19 -05:00