Commit Graph

11997 Commits

Author SHA1 Message Date
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 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
Tim Graham c2e419c267 Fixed #24054 -- Enabled sqlsequencereset for apps with migrations. 2014-12-26 15:55:34 -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
Tim Graham 271d4f8f85 Fixed #23948 -- Moved password help text from the template to the form.
Thanks Mithos for the report and patch.
2014-12-26 08:09:12 -05:00
Tim Graham 3325ec869c Fixed #24045 -- Removed useless mark_safe() call in trans_null.py 2014-12-26 07:42:49 -05:00
Claude Paroz ffa548fb56 Updated link to CSRF docs
Refs #23866.
2014-12-25 14:01:15 +01:00
Claude Paroz 234a2e0b6b Fixed #23866 -- Harmonized refs to Django documentation from code 2014-12-25 13:53:13 +01:00
Tim Graham 426ead27bd Removed shutil.copystat copied from stdlib (added to support an old Python?). 2014-12-24 19:29:33 -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
Collin Anderson 5dddd79433 Fixed #20349 -- Moved setting_changed signal to django.core.signals.
This removes the need to load django.test when not testing.
2014-12-24 07:18:43 -05: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
Tim Graham 69ee7c8d76 Removed models.Field.bind() -- unused/undocumented since at least 1.0. 2014-12-23 14:23:58 -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
Anssi Kääriäinen f233bf47dd Fixed #21414 -- Removed RelatedObject and deprecated Field.related. 2014-12-23 10:54:25 -05:00
Claude Paroz 6e08bde8c4 Added RasterSource/GDALBand GDAL objects
Based on Daniel Wiesmann's raster branch. Thanks Daniel Wiesmann
and Tim Graham for the reviews. Refs #23804.
2014-12-23 16:36:18 +01: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
Anssi Kääriäinen 227a4c48be Refs #2443 -- fixed format_dtdelta on SQLite
A test failed on Python 2 32-bit.
2014-12-23 07:05:44 -05:00
Marc Tamlyn 962bb9b6bd Refs #2443 -- Move the durationfield converter logic.
This reduces how frequently this logic is run significantly.

Thanks to Anssi for the suggestion.
2014-12-23 10:41:42 +00:00
Marc Tamlyn 5ca82e710e Fixed #24033 -- Use interval type on Oracle.
Use INTERVAL DAY(9) TO SECOND(6) for Durationfield on Oracle rather than
storing as a NUMBER(19) of microseconds.

There are issues with cx_Oracle which require some extra data
manipulation in the database backend when constructing queries, but it
handles the conversion back to timedelta objects cleanly.

Thanks to Shai for the review.
2014-12-23 10:38:32 +00:00
Collin Anderson a58cfe8e71 Upgrade jQuery from 1.11.1 to 1.11.2
refs #23355
2014-12-22 20:32:00 -05:00
Tim Graham 01ab84c613 Fixed #23525 -- Fixed admindocs crash on apps installed as eggs.
Thanks welbornprod for report and initial patch.
2014-12-22 15:19:18 -05: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 07728a2c2c Refs #2443 -- Fix Oracle tests for DurationField.
It helps if there are the correct number of microseconds in a second.
2014-12-20 22:04:07 +00: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
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
Anssi Kääriäinen 4a2a433e7d Refs #24020 -- return expressions from get_group_by_cols() 2014-12-18 06:01:07 -07:00
Claude Paroz 9c1f501d7b Fixed #24014 -- Unified OGRException and GDALException
Thanks Tim Graham for the review.
2014-12-18 11:28:17 +01: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
Tim Graham f3eed95175 Removed netCDF from GIS driver testing; refs #23804.
It may not be installed on all systems.
2014-12-17 09:30:59 -05: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
Andriy Sokolovskiy 3dbbb8a89c Fixed #23983 -- Fixed a crash in migrations when adding order_with_respect_to to non-empty table. 2014-12-16 10:48:49 -05:00
Tim Graham 4efe1b79e9 Refs #23884 -- Silenced a deprecation warning in sitemaps tests. 2014-12-15 19:15:26 -05:00
Andriy Sokolovskiy d8f3b86a76 Fixed #23405 -- Fixed makemigrations prompt when adding Text/CharField.
A default is no longer required.
2014-12-15 14:41:52 -05:00
Andriy Sokolovskiy 089047331d Fixed #23987 -- Made SQLite SchemaEditor always use effective_default(). 2014-12-15 13:40:24 -05:00
Tim Graham 0d5ca7b560 Moved an import in an auth test; refs #23925.
This keeps tests/__init__.py from importing other modules and may fix a problem
with test discovery revealed in formtools tests on Travis CI.
2014-12-15 10:09:18 -05:00
Berker Peksag 9aeb917dad Fixed #23884 -- Moved FlatPageSitemap into django.contrib.flatpages. 2014-12-15 09:45:31 -05:00
Markus Holtermann aa5ef0d4fc Fixed #23822 -- Added support for serializing model managers in migration
Thanks to Shai Berger, Loïc Bistuer, Simon Charette, Andrew Godwin,
Tim Graham, Carl Meyer, and others for their review and input.
2014-12-15 08:34:15 -05:00
Markus Holtermann e37ab311fc Changed internal storing of abstract and concrete managers to be in a single list.
This commit prepares the internal manager layout to be serialized by
migrations; refs #23822.
2014-12-15 08:32:47 -05:00
Shai Berger 7c1f3901bc Fixed #23991 -- Apparently, Oracle doesn't need the decimal field converter
Thanks Josh Smeaton for review.
2014-12-15 00:07:10 +02:00
Aymeric Augustin 0fc1882510 Merge pull request #3730 from tchaumeny/test_suite_reorder
Fixed #23992 -- Optimized reorder_suite functions using OrderedSet
2014-12-14 17:29:34 +01:00
JuneHyeon Bae 9495989265 Fixed timesince translations for Korean
Refs #23989.
Forward port of eb632bfba from stable/1.7.x.
2014-12-14 16:48:42 +01:00
Thomas Chaumeny 2ca0870b67 Fixed #23992 -- Optimized reorder_suite functions using OrderedSet 2014-12-14 13:38:01 +01:00
Michael Hall 895dc880eb Fixed #23812 -- Changed django.utils.six.moves.xrange imports to range 2014-12-13 12:45:58 -05:00
Claude Paroz a5499b0916 Removed empty gis models.py
Refs #22645.
2014-12-13 16:23:49 +01:00
Carl Meyer c72eb80d11 Fixed #23455 -- Accept either bytes or text for related_name, convert to text. 2014-12-12 12:50:39 -07:00
Carl Meyer 8aaf51f94c Revert "Fixed #23455 -- Forced related_name to be a unicode string during deconstruction."
This reverts commit 45bd7b3bd9.
2014-12-12 12:50:39 -07:00
Claude Paroz df30ae07fc Fixed postgis test database initialization
Refs #20968. Allow querying template_postgis presence without
existing test database.
Thanks Tim Graham for the review.
2014-12-12 20:08:07 +01:00
Tim Graham c7a19f4203 Fixed #23857 -- Fixed admin crash with "save as new" and deleting inline.
Thanks amarandon for the report.
2014-12-12 10:24:39 -05:00
Josh Smeaton 267a1dcd9b Fixed #23941 -- Removed implicit decimal formatting from expressions. 2014-12-12 10:17:48 -05:00
Kevin Marsh e2868308bf Fixed template tag braces spacing. 2014-12-12 09:34:18 -05:00
Thomas Chaumeny 119154ca7f Refs #20392 -- Load fixtures once within TestCase 2014-12-12 09:16:15 -05:00
Grzegorz Slusarek 0dea81cd6d Fixed #23674 -- Fixed a crash when a MultiValueField has invalid data. 2014-12-12 08:47:21 -05:00
Sergey Parkhomenko 059c9ab24c Fixed #23977 -- Added setdefault() method to HttpResponse 2014-12-11 13:56:56 -05:00
Markus Amalthea Magnuson d4e449d730 Fixed typo in admin deprecation message. 2014-12-11 13:30:31 -05:00
Markus Holtermann 44927ba817 Fixed #23956 -- Fixed migration creation for multiple table inheritance 2014-12-11 13:28:21 -05:00
Marc Tamlyn 6b2d3f9206 Remove text-mangling of default values. 2014-12-09 09:10:51 +00:00
Claude Paroz bac7664f27 Ran 'CREATE EXTENSION postgis' during prepare_database hook
DatabaseWrapper.prepare_database has been introduced in 307de67073.
2014-12-08 22:22:53 +01:00
Claude Paroz 8f97413fae Fixed #20968 -- Checked Spatialite metadata before migrations
Thanks Kenial S. Lee for the initial patch and Tim Graham for
the review.
2014-12-08 22:22:53 +01:00
Jon Dufresne 4468c08d70 Fixed #23968 -- Replaced list comprehension with generators and dict comprehension 2014-12-08 07:58:23 -05:00
Diego Guimarães 9f427617e4 Refs #23947 -- Worked around a bug in Python that prevents deprecation warnings from appearing in tests. 2014-12-06 14:46:01 -05:00
Aymeric Augustin 4832320e8d Updated obsolete comment. 2014-12-06 20:39:53 +01:00
Tim Graham b6ea059b4a Fixed #23957 -- Started deprecation toward requiring session verification.
Thanks Carl Meyer for review.
2014-12-05 07:37:34 -05:00
Claude Paroz 8d7a48027e Fixed #23954 -- Added special text/varchar PostgreSQL indexes in migrations
Thanks adityagupta104 for the report and Tim Graham for the review.
2014-12-04 21:27:42 +01:00
Tim Graham 765fa36d57 Fixed #23920 -- Fixed MySQL crash when adding blank=True to TextField.
Thanks wkornewald for the report and Markus Holtermann for review.
2014-12-04 10:57:10 -05:00
Thomas Tanner 018d110ef5 Fixed #23911 -- Added support for buffer file uploads in the test client 2014-12-04 07:42:03 -05:00
Berker Peksag 560b4207b1 Removed redundant numbered parameters from str.format().
Since Python 2.7 and 3.1, "{0} {1}" is equivalent to "{} {}".
2014-12-03 14:27:38 -05:00
Tim Graham b06dfad88f Fixed #23939 -- Moved session verification out of SessionAuthenticationMiddleware.
Thanks andrewbadr for the report and Carl Meyer for the review.
2014-12-03 13:11:47 -05:00
Thomas Chaumeny da9fe5c717 Fixed #20392 -- Added TestCase.setUpTestData()
Each TestCase is also now wrapped in a class-wide transaction.
2014-12-03 10:37:04 -05:00
Gavin Wahl dee4d23f7e Fixed #23950 -- Prevented calling deconstruct on classes in MigrationWriter. 2014-12-03 08:22:29 -05:00
Eric Rouleau 9d1a69579b Fixed #23935 -- Converted decimals to fixed point in utils.numberformat.format 2014-12-03 07:49:06 -05:00
Tim Graham 5c773447c3 Tweaked fix for refs #23946; thanks Claude. 2014-12-02 15:57:08 -05:00
Claude Paroz 00fa1474d7 Added raster support for GDAL Driver class
Based on Daniel Wiesmann's work. Refs #23804.
2014-12-02 19:56:50 +01:00
Daniel Wiesmann ac51496ceb Added cpl error codes to errcheck functions
GDAL raster methods return different error codes from the vector
API.
2014-12-02 19:56:50 +01:00
Daniel Wiesmann 4df3a3e0e9 Added GDAL prototypes for raster support
Refs #23804.
2014-12-02 19:56:35 +01:00
Andriy Sokolovskiy bba545345f Fixed #23946 -- Fixed runserver crash when socket error contains Unicode chars. 2014-12-02 12:01:51 -05:00
Kamil Braun 0623f4dea4 Fixed #23934 -- Fixed regression in admin views obj parameter. 2014-12-02 08:42:17 -05:00
jerry dumblauskas 5760fe66df Fixed typo in django/dispatch/dispatcher.py docstring. 2014-12-02 07:26:45 -05:00
wrwrwr bfc75996f9 Fixed #23945 -- Made default site use the configured SITE_ID. 2014-12-01 19:36:50 -05:00
Andriy Sokolovskiy 1739ae9edc Fixed #23807 -- Ignored non-digits in psycopg2 version 2014-12-01 18:42:08 -05:00
Tim Graham 82e4f956e3 Fixed #23289 -- Added mock as a test dependency. 2014-12-01 16:08:25 -05:00
wrwrwr 1f98ec2e53 Fixed #23929 -- Added more tests for create_default_site.
Refs: #15346, #15573, #16353, #16828.
2014-12-01 14:38:16 -05:00
Claude Paroz e11c6fd218 Fixed #23909 -- Prevented crash when collecting SQL for RunSQL
Thanks James Rivett-Carnac for the report and Markus Holtermann
for the review.
2014-12-01 20:26:40 +01:00
wrwrwr 777b4c26e3 Removed a clear_cache statement in contrib.sites.create_default_site.
It was originally added to fix a test (refs #7514); but Site now has a
pre_save signal handler (refs #19698) to clear the cache which makes
this call redundant.
2014-12-01 13:19:58 -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
Shai Berger 88edce2abb Restored the 'TEST_' prefix in the warning about deprecated test database settings 2014-12-01 02:12:19 +02: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
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
Matthew Somerville 9253042d53 Fixed #4444 - Made runserver suppress 'broken pipe' errors
One handler in WSGIServer, to catch the error when raised from
SocketServer.BaseServer's finish_request, and one in WSGIRequestHandler
(by creating a subclass of ServerHandler), to catch the error when
raised in wsgiref.handlers.BaseHandler's finish_response.
2014-11-28 10:51:15 -05:00
sdeprez 9e80c5f457 Fixed #23925 -- Allowed settings.AUTHENTICATION_BACKENDS to reference import aliases 2014-11-28 10:47:33 -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 dd35cc232a Fixed #23641 -- Moved post_migrate signals for contrib apps to AppConfig.ready(). 2014-11-27 13:06:35 -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
Anssi Kääriäinen c7fd9b242d Fixed #23875 -- cleaned up query.get_count() 2014-11-27 06:26:53 -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
Tim Graham 14a3b60981 Fixed #23677 -- Removed contrib.formtools 2014-11-26 09:56:33 -05:00
Simon Charette 9cebb95348 Adjusted a comment to reflect some app refactor changes. 2014-11-26 09:47:37 -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
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
Martin Blech 4c123d0f79 Fixed #23899 -- Added 'Generated by Django X.Y' to startproject template. 2014-11-25 09:41:56 -05:00
Berker Peksag 9a30acad8a Fixed #21587 -- Added a warning for changing default of RedirectView.permanent. 2014-11-25 09:22:18 -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
Sergey Fedoseev 1e9ac504e4 Fixed #23888 -- Fixed crash in File.__repr__() when name contains unicode. 2014-11-24 15:54:57 -05:00
Tim Graham ebb927c4c9 Removed workaround for lack of os.getpid() in Jython.
The Jython bug was fixed in http://bugs.jython.org/issue1518
(tested on Jython 2.7b3); also updated make_msgid() to be more like
the version in Python 3.2+; refs #23905.

Thanks Simon Charette for testing and review.
2014-11-24 14:01:15 -05:00
Berker Peksag a5bd7f2cb2 Fixed #13694 -- Made SafeMIMEText's constructor compatible with MIMEText. 2014-11-24 13:28:58 -05:00
Tom V d049b36f91 Fixed typo in django/utils/decorators.py comment. 2014-11-24 10:45:29 -05:00
Tim Graham 0b16c1322f Simplified get_version() in django/__init__.py
Thanks Luke Plant for the report.
2014-11-24 07:02:29 -05:00
Matt Robenolt 80facd7a0f Removed unused variable django.http.request.absolute_http_url_re 2014-11-24 07:01:55 -05:00
Aymeric Augustin 18533fb558 Removed direct references to template-related settings. 2014-11-23 11:54:22 +01:00
Aymeric Augustin 6294bd3903 Encapsulated TEMPLATE_DEBUG in Engine. 2014-11-23 11:54:17 +01:00
Aymeric Augustin 47a131b944 Encapsulated TEMPLATE_STRING_IF_INVALID in Engine. 2014-11-23 11:53:53 +01:00
Aymeric Augustin 37505b6397 Encapsulated TEMPLATE_CONTEXT_PROCESSORS in Engine.
Since RequestContext doesn't know its Engine until it's passed to
Template.render() -- and cannot without breaking a widely used public
API -- an elaborate hack is required to apply context processors.
2014-11-23 11:53:18 +01:00
Aymeric Augustin 98ac69af53 Encapsulated ALLOWED_INCLUDE_ROOTS in Engine. 2014-11-23 11:52:54 +01:00
Aymeric Augustin 246cfdeae3 Moved make_origin into the Engine class. 2014-11-23 11:52:45 +01:00
Aymeric Augustin 240ea67ce0 Move compile_string into the Engine class. 2014-11-23 11:52:25 +01:00
Aymeric Augustin 5b1bb40216 Added to each Context a reference to the Engine.
It's only available during the rendering.
2014-11-23 11:52:22 +01:00
Aymeric Augustin a2dd08666c Removed dependency of template loaders on Django settings. 2014-11-23 11:52:14 +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 544a716da8 Removed unused API get_template_loaders.
It was introduced in a recent refactoring so this isn't an issue.

Then renamed _get_template_loaders to get_template_loaders.
2014-11-23 11:51:31 +01:00
Aymeric Augustin 572cdb4391 Introduced a template engine class.
Moved Django templates loading infrastructure there.
2014-11-23 09:29:53 +01:00
Aymeric Augustin 17012b6936 Deprecated dirs argument to override TEMPLATE_DIRS.
Cancels 2f0566fa. Refs #4278.
2014-11-23 09:29:33 +01:00
Carl Meyer bcb693ebd4 Revert "Fixed #23892 -- Made deconstructible classes forwards compatible"
This reverts commit f36151ed16.

Adding kwargs to deconstructed objects does not achieve useful
forward-compatibility in general, since additional arguments are silently
dropped rather than having their intended effect. In fact, it can make the
failure more difficult to diagnose. Thanks Shai Berger for discussion.
2014-11-22 22:29:23 -07:00
Carl Meyer f36151ed16 Fixed #23892 -- Made deconstructible classes forwards compatible 2014-11-22 14:30:14 -07:00
Carl Meyer a9cced7aec Fix another flake8 warning.
I don't agree with flake8 here about the right indentation, but as long as
we're using it, we should stick to it. I don't want to disable its hanging
indent checks just because of this case.
2014-11-22 14:21:32 -07: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
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
Collin Anderson d4ea4eea79 Fixed #23889 -- Added more usage of quote_name_unless_alias() to avoid deprecation warnings. 2014-11-21 16:44:50 -05:00
Simon Charette c7087bc777 Fixed #23862 -- Made ManyToManyRel.get_related_field() respect to_field. 2014-11-21 16:02:31 -05:00
Simon Charette a7c3d0f288 Fixed typo in forms/models.py comment. 2014-11-21 15:59:09 -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
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
Tim Heap 5b17dcd8ef Fixed #23883 -- Stopped flatatt modifying its argument 2014-11-21 09:45:08 +01:00
Brad Walker 54d3dcbc51 Removed reduce() usage in makemigrations; refs #23796.
A lambda all_items_equal() replaced a reduce() that was broken for potential
3+-way merges. A reduce(operator.eq, ...) accumulates bools and can't
generically check equality of all items in a sequence:

>>> bool(reduce(operator.eq, [('migrations', '0001_initial')] * 3))
False

The code now counts the number of common ancestors to calculate slice offsets
for the branches. Each branch shares the same number of common ancestors.

The common_ancestor for loop statement had incomplete branch coverage.
2014-11-20 14:33:30 -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
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
Claude Paroz 1a63093e22 Added AutoField introspection for PostgreSQL
Refs #23748.
2014-11-20 16:13:58 +01:00
Claude Paroz 11662022be Added AutoField introspection for MySQL
Refs #23748.
2014-11-20 16:13:58 +01:00
Berker Peksag 788fa9fffa Fixed #12098 -- Simplified HttpRequest.__repr__(). 2014-11-20 08:45:11 -05:00
Carl Meyer d6e2bbe734 Fixed #23876 -- Removed dead code in SQLAggregateCompiler. 2014-11-20 04:18:08 -07:00
Carl Meyer d2bcb05980 Fixed #23873 -- Improved GIS error message when GEOS is not installed.
Thanks Claude for writing the patch.
2014-11-19 19:23:13 -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 e7b9a58b08 Fixed #21794 -- Removed deprecation warning for abstract models outside an app. 2014-11-19 15:56:04 -07:00
Carl Meyer 4932a7b8e0 Fixed GIS tests to again skip without error when GEOS is not installed. 2014-11-19 14:29:05 -07:00
Tim Graham 5bcd292098 Fixed #23871 -- Removed promotion of MySQL warnings to errors in DEBUG mode. 2014-11-19 16:07:49 -05:00
Aymeric Augustin 45db7f7db8 Replaced caching of a property with @cached_property. 2014-11-19 21:53:24 +01:00
Aymeric Augustin 9d3d1a0321 Simplified caching of supported languages. 2014-11-19 21:35:40 +01:00
Aymeric Augustin 0900815097 Simplified caching of the default exception reporter filter.
Also simplified the logic under the assumption that a false-ish object
won't have an exception_reporter_filter attribute.
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
Aymeric Augustin e23240474b Simplified caching of get_default_timezone(). 2014-11-19 21:35:39 +01:00
Aymeric Augustin dca33ac15d Simplified caching of password hashers.
load_hashers cached its result regardless of its password_hashers
argument which required fragile cache invalidation. Remove that
argument in favor of @override_settings and triggering cache
invalidation with a signal.
2014-11-19 21:35:39 +01:00
Carl Meyer 0eba8bd8f6 Fixed GeoSQLCompiler to pass itself correctly to column as_sql. 2014-11-19 08:33:38 -07:00
Carl Meyer 84d88f5cbe Removed a deprecated use of SQLCompiler as quote_name in GIS. 2014-11-19 08:03:48 -07:00
Stratos Moros cf7a2a000e Fixed #22248 -- Made RenameModel reversible 2014-11-19 14:11:35 +02:00
Carl Meyer 08fbbaa45b Deprecated calling a SQLCompiler instance. 2014-11-18 19:47:16 -07: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 4b9eb7602d Normalized check that ALLOWED_INCLUDE_ROOTS is a tuple. 2014-11-17 22:49:01 +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
twidi 19ae13d9ed Avoided unneeded calls to state.render() in migrations. 2014-11-17 18:44:09 +01:00
twidi 82aca216e1 Reordered condition to avoid calling allow_migrate() if unneeded. 2014-11-17 18:32:42 +01:00
Anssi Kääriäinen 4252a14c39 Moved bilateral transform fetching to models.lookups 2014-11-17 18:04:08 +01:00
Claude Paroz fc36437434 Added assertion error message for test_make_line
Refs #23842. Thanks Thomas Chaumeny for the suggestion.
2014-11-17 14:17:08 +01:00
Claude Paroz 684b2077b3 Improved readability of negative condition in makemessages
Thanks Berker Peksag for the suggestion.
2014-11-17 13:42:14 +01:00
Claude Paroz 6a05f0dfe3 Simplified handle_extensions management utility
makemessages now doesn't need any special ignoring logic, after
commit bb4a92d784.
2014-11-17 09:24:56 +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
Aymeric Augustin fab26cf5e0 Removed support for function-based template loaders.
They were deprecated in Django 1.2 but not all the supporting code was
removed in Django 1.4. Since the remaining code was unlikely to be
functional (pun intended) e.g. it would crash unless the loader
function had an is_usable attribute, this commit completes the removal
immediately instead of starting another deprecation path.
2014-11-16 22:18:33 +01:00
Aymeric Augustin e87bee6f50 Used get_template_loaders in the cached loader.
This ensures that enabling the cached loader doesn't change behavior.

(Before this commit, it did when the list contained unusable loaders.)
2014-11-16 21:41:44 +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 1851dcf377 Deprecated function-based loaders. 2014-11-16 21:41:42 +01:00
Aymeric Augustin 0bf99193f8 Removed obsolete comment.
It didn't account for class-based template loaders.
2014-11-16 21:40:54 +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 d58597a7b8 Refactored listing template subdirectories in apps.
This change has the nice side effect of removing code that ran at import
time and depended on the app registry at module level -- a notorious
cause of AppRegistryNotReady exceptions.
2014-11-16 21:28:43 +01:00
Aymeric Augustin cd7146debe Removed skip_template argument of locmem.Loader.load_template_source.
It didn't do anything, wasn't documented and wasn't used anywhere.
2014-11-16 21:28:37 +01:00
Aymeric Augustin c211c59b4a Removed the "test:" prefix from locmem template identifiers.
Since it isn't branded as a test utility any more and could be used for
other purposes than test code, that prefix no longer makes sense.

It wasn't used anywhere either.
2014-11-16 21:28:31 +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
Aymeric Augustin cffa559082 Fixed regression in 4dc4d12e. Refs #21598.
That commit contained a mistake that resulted in the use_cached_loader
option of override_with_test_loader being ignored. As a consequence some
configurations weren't exercised any more by the test suite.
2014-11-16 21:25:09 +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
Marc Tamlyn 4024dd0c98 Merge pull request #3526 from gregorth/ticket_23585
Fixed #23585 - Corrected internal comment.
2014-11-16 09:24:22 +00:00
Berker Peksag d2d6c0c097 Fixed #21363 -- Added datetime.timedelta support to TimestampSigner.unsign(). 2014-11-15 19:36:33 +01:00
Carl Meyer 1ed9b9e2e2 Merge pull request #3536 from Zweedeend/ticket_23837
Fixes #23837: Replace list with deque in migration-planner for improved performance.
2014-11-15 18:56:52 +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
Erik Romijn c1584e1df4 Refs #23793 -- Fixed test failure after password reset messages clarification 2014-11-15 17:05:24 +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
Niels Kouwenhoven fefb77934e Fixes #23837: Replace list.pop(0) by deque.popleft() in dfs function in migrations 2014-11-15 16:34:20 +01:00
Yigit Guler 9dde0a211e Fixed #23793 -- Clarified password reset messages. 2014-11-15 16:29:13 +01: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
Grzegorz Slusarek b4bb5cd0a3 Fixed #23585 - Corrected internal comment.
Removed misleading comment and provide correct one, explaining
idea behind hardcoded CSRF template context processor.
2014-11-15 14:07:31 +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
Tim Graham 7ef81b5cdd Removed thread customizations of six which are now built-in. 2014-11-13 10:30:53 +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
Aymeric Augustin f742c653e0 Removed return from __init__.
__init__ isn't allowed to return anything other than None and it isn't
common practice to include a return statement.
2014-11-12 21:26:31 +01:00
Tim Graham aa77e90aa9 Remove Field.get_validator_unique_lookup_type()
Usage of this method was removed pre 1.0 (c2ba59fc).
2014-11-12 20:11:40 +01:00
Tim Graham 42b5e4feea Fixed #23730 -- Moved support for SimpleCookie HIGHEST_PROTOCOL pickling to http.cookie.
This fix is necessary for Python 3.5 compatibility (refs #23763).

Thanks Berker Peksag for review.
2014-11-12 19:04:45 +01:00
Anssi Kääriäinen 4e9a6c94e6 Removed extra enumerate() from Query.setup_joins() 2014-11-12 13:22:08 +02:00
Jozef Knaperek c56c42b5c0 Fixed #22967 -- Made Model._do_update consistent
Made _do_update behave more strictly according to its docs,
including a corner case when specific concurent updates are
executed and select_on_save is set.
2014-11-12 12:53:30 +02:00
Anssi Kääriäinen d647764a53 Improved Query.names_to_path docstring 2014-11-12 12:40:55 +02:00
Aymeric Augustin 3bc7a14ea5 Normalized opening a file and decoding its content.
`io.open` is required on Python 2.7. Just `open` would work on Python 3.
2014-11-11 22:54:27 +01:00
Aymeric Augustin 95b8323ac2 Removed import forgotten in previous commit. 2014-11-11 22:54:26 +01:00
Claude Paroz 5ec367ccdd Fixed #23788 -- Used new JavaScript support in recent gettext
JavaScript string extraction support has been added in gettext
0.18.3.
Thanks Aymeric Augustin for the review.
2014-11-11 22:52:30 +01:00
Aymeric Augustin b8ba73cd0c Raised SuspiciousFileOperation in safe_join.
Added a test for the condition safe_join is designed to prevent.

Previously, a generic ValueError was raised. It was impossible to tell
an intentional exception raised to implement safe_join's contract from
an unintentional exception caused by incorrect inputs or unexpected
conditions. That resulted in bizarre exception catching patterns, which
this patch removes.

Since safe_join is a private API and since the change is unlikely to
create security issues for users who use it anyway -- at worst, an
uncaught SuspiciousFileOperation exception will bubble up -- it isn't
documented.
2014-11-11 19:05:14 +01:00
averybigant b7a5b6ab86 Fixed #23750 -- Allowed core.checks.register to be used as a function 2014-11-11 16:29:32 +01:00
Anssi Kääriäinen b3fd39f7c8 Simplified Query.build_lookup() 2014-11-11 08:14:29 +02:00
Aymeric Augustin b239c3d27e Fixed negligible formatting error. 2014-11-10 21:41:35 +01:00
Thomas Chaumeny 498ae3a360 Removed legacy code from old transaction system 2014-11-10 18:28:46 +01:00
Thomas Chaumeny 88b2a20f04 Simplified MySQL storage engine detection using INFORMATION_SCHEMA.ENGINES table
Query the table introduced in MySQL 5.1; refs #23144.
2014-11-10 18:16:14 +01:00
Luke Plant b748a8bc67 Fixed #23789 -- TemplateResponse handles context differently from render 2014-11-10 14:47:45 +00:00
Markus Holtermann c7c098cf97 Fixed #23770 -- Changed serialization strategy for floats with respect to NaN and Inf
Thanks to w0rp for the report
2014-11-06 15:30:30 +01:00
Tim Graham b07aa52e8a Added a dummy class for HTMLParserError; refs #23763. 2014-11-05 09:54:35 -05:00
Tim Graham 81477c91f6 Updated six to 1.8.0. 2014-11-04 20:38:38 -05:00
Berker Peksag df0523debc Fixed #23531 -- Added CommonMiddleware.response_redirect_class. 2014-11-04 17:56:57 -05:00
Peter Inglesby 74e1980cf9 Fixed #13181 -- Added support for callable choices to forms.ChoiceField
Thanks vanschelven and expleo for the initial patch.
2014-11-04 11:23:58 -05:00
Marc Tamlyn 36f514f065 Added HStoreField.
Thanks to `django-hstore` for inspiration in some areas, and many people
for reviews.
2014-11-04 09:26:40 +00:00
Veres Lajos a71a2ea756 Fixed typos using https://github.com/vlajos/misspell_fixer 2014-11-03 20:59:30 -05:00
Zan Anderle 7b42036752 Fixed #5405 -- Added admindocs support for reStructured text in model docstrings
Thanks elvard and gkmngrgn for work on the patch and Markus H. for review.
2014-11-03 15:30:46 -05:00
Zan Anderle 1cf109515a Changed docstrings in admindocs/utils to comply to PEP 257 2014-11-03 15:00:49 -05:00