Commit Graph

12381 Commits

Author SHA1 Message Date
Tim Graham 8a481498aa Fixed #24468 -- Made signed cookies cache backend resilient to unpickling exceptions. 2015-03-12 08:19:54 -04:00
Anton Danilchenko 28e8c54d7d Fixed #24467 -- Removed conditional inclusion of actions.js & prepopulate.js.
The JavaScript may be required when using ModelAdmin.get_actions() or
get_prepopulated_fields(). Always including them is the easiest solution.
2015-03-11 20:18:59 -04:00
Rik ccff08c194 Fixed #24463 -- Removed mod_python functionality from HttpRequest._get_scheme() 2015-03-11 14:35:25 -04:00
Tim Graham 3ed9c7bdfe Fixed #24471 -- Enhanced urlize regex to exclude quotes and angle brackets. 2015-03-10 19:24:46 -04:00
Tim Graham 7b1a67cce5 Fixed escaping regression in urlize filter.
Now that the URL is always unescaped as of refs #22267,
we should re-escape it before inserting it into the anchor.
2015-03-10 18:58:34 -04:00
Bas Peschier 756cee46d2 Fixed #24455 -- Fixed crash in debug view with lazy objects 2015-03-09 20:30:01 -04:00
Claude Paroz 578ac17f81 Made runserver use leave_locale_alone 2015-03-09 18:59:27 +01:00
Claude Paroz df193b3cef Fixed #24382 -- Allowed unicode chars inside formatted numbers
Thanks Jacob Rief for the report and Tim Graham for the review.
2015-03-09 18:55:28 +01:00
Erik Romijn fa350e2f30 Fixed #24464 -- Made built-in HTML template filter functions escape their input by default.
This may cause some backwards compatibility issues, but may also
resolve security issues in third party projects that fail to heed warnings
in our documentation.

Thanks Markus Holtermann for help with tests and docs.
2015-03-09 09:29:58 -04:00
Anssi Kääriäinen fb146193c4 Fixed #24171 -- Fixed failure with complex aggregate query and expressions
The query used a construct of qs.annotate().values().aggregate() where
the first annotate used an F-object reference and the values() and
aggregate() calls referenced that F-object.

Also made sure the inner query's select clause is as simple as possible,
and made sure .values().distinct().aggreate() works correctly.
2015-03-09 07:49:23 -04:00
Marten Kenbeek e272904ff7 Fixed #23407 -- Extended coverage of makemigrations --noinput option.
Changed --noinput option in makemigrations to suppress all user prompts,
not just when combined with --merge.
2015-03-08 19:44:14 +01:00
Bas Peschier 336512fae7 Fixed #23173 -- Fixed incorrect stripping of SCRIPT_URL 2015-03-08 15:48:27 +01:00
Rik a5b225084f Fixed #23838 -- added missing `__iter__` to LazyObject 2015-03-08 15:42:23 +01:00
Marten Kenbeek 888c9b6429 Fixed #24397 -- Sped up rendering multiple model states.
Set apps.ready to False when rendering multiple models. This prevents
that the cache on Model._meta is expired on all models after each time a
single model is rendered. Prevented that Apps.clear_cache() refills the
cache on Apps.get_models(), so that the wrong value cannot be cached
when cloning a StateApps.
2015-03-08 13:54:49 +01:00
Sztrovacsek 87d78241a2 Fixed #23986 -- Fixed collectstatic --clear failure if STATIC_ROOT dir doesn't exist. 2015-03-07 10:47:07 -05:00
Jean-Louis Fuchs f4f0060fea Fixed #24447 -- Made migrations add FK constraints for existing columns
When altering from e.g. an IntegerField to a ForeignKey, Django didn't
add a constraint.
2015-03-07 14:09:56 +01:00
Tim Graham c36b60836b Fixed #24451 -- Deprecated comma-separated {% cycle %} syntax. 2015-03-07 07:42:39 -05:00
david 88c605e3e3 Fixed #23993 -- Added form.media to the admin login template. 2015-03-07 12:59:58 +01:00
Claude Paroz ec808e807a Fixed urlize regression with entities in query strings
Refs #22267.
Thanks Shai Berger for spotting the issue and Tim Graham for the
initial patch.
2015-03-06 22:20:14 +01:00
Josh Smeaton ceaf31adff Fixed #24420 -- Allowed ordering by case expressions 2015-03-06 13:30:02 +11:00
Grzegorz Slusarek 668d53cd12 Fixed #21495 -- Added settings.CSRF_HEADER_NAME 2015-03-05 15:03:40 -05:00
Tim Graham d61ebc8fed Fixed #19538 -- Removed window.__admin_media_prefix__ from admin templates. 2015-03-05 06:44:16 -05:00
Claude Paroz 8714403614 Fixed #24428 -- Fixed has_changed for fields with coercion
Thanks Carsten Fuchs for the report.
2015-03-05 09:00:13 +01:00
Claude Paroz 767c33d1fa Fixed #24369 -- Prevented crash when flushing before db migration
Thanks Thomas Tanner for the report and Tim Graham for the review.
2015-03-05 08:57:28 +01:00
Benjamin Wohlwend d6969abf23 Moved definition of chunks out of timesince function.
This speeds up the timesince function/filter substantially.
2015-03-04 22:30:14 +01:00
Tim Graham 36a17be9f3 Fixed #24426 -- Displayed admin actions panel when show_full_result_count=False. 2015-03-04 12:00:12 -05:00
Tim Graham fe42bfaaff Used format_html() in contrib.admin.utils for consistency. 2015-03-04 10:26:04 -05:00
Markus Holtermann a9e29fae10 Fixed #24435 -- Prevented m2m field removal and addition in migrations when changing blank
Thanks Mark Tranchant for the report an Tim Graham for the test and
review.
2015-03-04 14:26:49 +01:00
Preston Timmons 70123cf084 Fixed #24399 -- Made filesystem loaders use more specific exceptions. 2015-03-03 21:20:46 +01:00
Mathias André 85757d0e79 Removed outdated docstring for get_admin_url().
Since a4b8a4b632 the admin
URL returned by get_admin_url() is no longer relative to
the Django admin index page.
2015-03-03 07:46:12 -05:00
Preston Timmons 358850781f Fixed #24372 - Replaced TokenParser usage with traditional parsing. 2015-03-02 18:25:28 -05:00
Claude Paroz 80be597a7b Fixed #24360 -- Delayed internal LocaleMiddleware variable initialization
Failing in a middleware `__init__` is preventing proper debug view.
2015-03-02 20:06:24 +01:00
Andrei Kulakov 08572e8d12 Fixed #24294 -- Allowed staff_member_required decorator to handle args. 2015-03-02 13:15:34 -05:00
Tim Graham 4e8b167e4d Fixed MySQL build failure introduced by refs #24390.
Added table_name back to _create_index_sql() to prevent
duplicate index names on MySQL.
2015-03-02 13:07:34 -05:00
László Károlyi f37c11eea3 Fixed #24390 -- Made migration index names deterministic. 2015-03-02 09:25:19 -05:00
Corey Farwell 4fdc7015c0 Used dict comprehension in URLNode
4468c08d7 replaced a lot of the old `dict()` comprehensions
with the new style, but missed this one.
2015-03-02 08:50:27 -05:00
Preston Timmons 80d6b6b863 Fixed #24409 -- Combined the app_directories and filesystem loader implementation.
Besides the directories they look in, these two loaders are functionally
the same. This removes unnecessary code duplication between the two.
2015-03-02 07:53:58 -05:00
Claude Paroz 4b8979e477 Fixed #17401 -- Made SelectDateWidget.render reflect wrong value
Thanks Marcin Wrobel for the initial patch.
2015-03-01 21:37:52 +01:00
Claude Paroz 23c612199a Simplified emit_post_migrate from flush command
Follow-up of f4f24d30e0.
2015-02-28 16:10:32 +01:00
Claude Paroz 90ab6ee612 Revert "Fixed #24369 -- Prevented crash when `flush`ing before db migration"
This reverts commit 9f1dbe29c0.
The proposed solution does not pass the test suite.
2015-02-28 12:11:27 +01:00
Claude Paroz 9f1dbe29c0 Fixed #24369 -- Prevented crash when `flush`ing before db migration
Thanks Thomas Tanner for the report.
2015-02-28 10:12:32 +01:00
Claude Paroz 3cf1c02695 Fixed #24413 -- Prevented translation fallback for English
Thanks Tomasz Kontusz for the report, Baptiste Mispelon for
analysis and Tim Graham for the review.
2015-02-28 10:07:12 +01:00
Claude Paroz 5cf96b49e4 Fixed #24418 -- Prevented crash in refresh_from_db with null fk
Thanks Johannes Lerch for the report, Tim Graham for the test case,
and Simon Charette for the review.
2015-02-27 20:23:07 +01:00
Jon Dufresne 3b966c2b73 Fixed #24229 -- Changed IntegerField to clean floats representing integers 2015-02-27 12:23:21 +01:00
Rolf Jagerman fa9cb5dcdc Fixed #24406 -- Improved SelectFilter js to use click events
The SelectFilter widget used href to execute javascript. This was
problematic if one wishes to customize the widget, since the href
javascript is executed after events are handled. This change modifies
the javascript to use click events to handle button behavior.
2015-02-26 12:50:09 -05:00
Tim Graham 47b35b1844 Fixed #24411 -- Avoided dict key/method clash in admin delete views. 2015-02-25 07:15:56 -05:00
Michael Angeletti 65441bbdb0 Fixed #24391 -- Made BoundField.value() cache callable values. 2015-02-24 19:50:55 -05:00
Stanislas Guerra 4c2f546b55 Fixed #24395 -- Ensured inline ModelsForms have an updated related instance. 2015-02-24 11:49:00 -05:00
Aymeric Augustin b9c619abc1 Prevented makemigrations from writing in sys.path[0].
There's no reason to assume that sys.path[0] is an appropriate location
for generating code. Specifically that doesn't work with extend_sys_path
which puts the additional directories at the end of sys.path.

In order to create a new migrations module, instead of using an
arbitrary entry from sys.path, import as much as possible from the path
to the module, then create missing submodules from there.

Without this change, the tests introduced in the following commit fail,
which seems sufficient to prevent regressions for such a refactoring.
2015-02-23 19:55:10 +01:00
Tim Graham 1306cd1e8a Fixed #24377 -- Fixed model inline formsets with primary key's that have defaults. 2015-02-23 08:44:27 -05:00
Emin Mastizada dda2a3cf4c Added formats for the Azerbaijani locale. 2015-02-23 07:37:13 -05:00
Anssi Kääriäinen f95122e541 Fixed #24381 -- removed ForeignObjectRel opts and to_opts
These cached properies were causing problems with pickling, and in
addition they were confusingly defined: field.rel.model._meta was
not the same as field.rel.opts.

Instead users should use field.rel.related_model._meta inplace of
field.rel.opts, and field.rel.to._meta in place of field.rel.to_opts.
2015-02-23 07:24:43 -05:00
Marten Kenbeek 78d43a5e10 Fixed #24366 -- Optimized traversal of large migration dependency graphs.
Switched from an adjancency list and uncached, iterative depth-first
search to a Node-based design with direct parent/child links and a
cached, recursive depth-first search. With this change, calculating
a migration plan for a large graph takes several seconds instead of
several hours.

Marked test `migrations.test_graph.GraphTests.test_dfs` as an expected
failure due to reaching the maximum recursion depth.
2015-02-23 12:38:53 +01:00
Michael Manfre 7fa7dd48c4 Fixed signature of BaseDatabaseOperations.date_interval_sql() and document the change. 2015-02-22 23:23:16 -05:00
Aymeric Augustin 556a74879f Fixed a few uses of Template that relied on a default engine.
Refs #24389.
2015-02-22 23:13:55 +01:00
Aymeric Augustin c688460df6 Removed rmtree_errorhandler.
The stated reason for its introduction in d18d37ce no longer applies
since Django's code repository was switched from Subversion to git.

Furthermore it never had any effect because shutil.rmtree ignores its
onerror argument when ignore_errors is True.

The reason for its use in template management commands is unclear.
2015-02-22 23:09:42 +01:00
Aymeric Augustin 88a5f17d25 Fixed #24389 -- Isolated the CSRF view from the TEMPLATES setting.
Thanks uranusjr for the report and analysis.
2015-02-22 15:46:35 +01:00
Michael Angeletti ea3168dc6c Fixed #24376 -- added verbose_name arg to UUIDField 2015-02-21 13:27:49 -05:00
Don Kirkby 99a1bbf985 Fixed typo in django/db/models/fields/files.py comment. 2015-02-20 20:11:13 -05:00
foresmac 1d1d5d1c31 Fixed #24341 -- Added specific error messages to RangeField subclasses 2015-02-20 16:49:15 -05:00
Simon Charette 19f7278c86 Removed reference to iteration count in the PBKDF2 hasher docstring. 2015-02-20 16:37:29 -05:00
Aymeric Augustin 51b606f75d Removed a non-obvious side-effect of assigning Context.template.
Explicit is better than implicit.
2015-02-20 22:27:48 +01:00
Frank Wiles e43f99d1a9 Fixed PBKDF2PasswordHasher comments to reflect reality. 2015-02-20 16:00:51 -05:00
Anssi Kääriäinen bad5f262bf Fixed #24328 -- cleaned up Options._get_fields() implementation 2015-02-20 13:00:12 -05:00
Loic Bistuer bed504d70b Fixed #24351, #24346 -- Changed the signature of allow_migrate().
The new signature enables better support for routing RunPython and
RunSQL operations, especially w.r.t. reusable and third-party apps.

This commit also takes advantage of the deprecation cycle for the old
signature to remove the backward incompatibility introduced in #22583;
RunPython and RunSQL won't call allow_migrate() when when the router
has the old signature.

Thanks Aymeric Augustin and Tim Graham for helping shape up the patch.

Refs 22583.
2015-02-20 21:34:09 +07:00
Marc Tamlyn c490e410af Fixed #24373 -- Added run_validators to ArrayField.
Thanks to DavidMuller for the report.
2015-02-20 11:51:46 +00:00
Marc Tamlyn 32d4db66b9 Update converters to take a consistent set of parameters.
As suggested by Anssi. This has the slightly strange side effect of
passing the expression to Expression.convert_value has the expression
passed back to it, but it allows more complex patterns of expressions.
2015-02-20 11:35:52 +00:00
Marc Tamlyn 4755f8fc25 Fixed #24343 -- Ensure db converters are used for foreign keys.
Joint effort between myself, Josh, Anssi and Shai.
2015-02-20 11:35:51 +00:00
Alex Vidal e467919c63 Fixed typo in django.core.servers.basehttp message. 2015-02-19 19:31:49 -05:00
Aymeric Augustin 1bfcc950ab Set context.template instead of context.engine while rendering.
This opens more possibilities, like accessing context.template.origin.

It also follows the chain of objects instead of following a shortcut.
2015-02-19 22:08:11 +01:00
Claude Paroz efb1f99f94 Fixed #20889 -- Prevented BadHeaderError when Python inserts newline
Workaround for http://bugs.python.org/issue20747.
In some corner cases, Python 2 inserts a newline in a header value
despite `maxlinelen` passed in Header constructor.
Thanks Tim Graham for the review.
2015-02-19 20:18:31 +01:00
Shai Berger ceadc94f09 Fixed #24307: Avoided redundant column nullability modifications on Oracle
Thanks Joris Benschop for the report, and Tim Graham for the tests.
2015-02-19 02:39:41 +02:00
Marten Kenbeek 15dc8d1c9d Fixed #24291 - Fixed migration ModelState generation with unused swappable models
Swapped out models don't have a _default_manager unless they have
explicitly defined managers. ModelState.from_model() now accounts for
this case and uses an empty list for managers if no explicit managers
are defined and a model is swapped out.
2015-02-18 19:05:10 +01:00
Adam Chainz e9282747a4 Removed unused foreign_key_re variables in MySQL/Oracle DB backends 2015-02-18 10:22:30 -05:00
Tim Graham 098fa12dd3 Refs #24324 -- Fixed crash in {% debug %} tag on Python 2.
If Django is installed in a path that contains non-ASCII characters,
the tag failed with UnicodeDecodeError.
2015-02-18 07:24:13 -05:00
Tim Graham fa66ea7532 Refs #24324 -- Fixed UnicodeDecodeError in MigrationWriter on Python 2. 2015-02-17 18:48:15 -05:00
Tim Graham bebc1e53a3 Refs #24324 -- Fixed UnicodeDecodeError in template_backends tests
The message for the SuspiciousFileOperation exception needs to
be a unicode string.
2015-02-17 18:44:31 -05:00
Tim Graham bad6280c4e Refs #24324 -- Fixed get_app_template_dirs() UnicodeDecodeError on Python 2.
The function implemented most of upath(), but skipped the check for
strings that are already unicode.
2015-02-17 08:19:58 -05:00
Tim Graham c9ece2e6b9 Refs #24324 -- Fixed UnicodeDecodeError in makemigrations.
If the project path contained a non-ASCII character, Python 2 crashed.
2015-02-17 08:12:49 -05:00
Tim Graham 63c5c98701 Refs #24324 -- Fixed UnicodeEncodeError in SQLite backend while testing.
If 'name' contained non-ASCII characters, the comparison raised a
UnicodeEncodeError on Python 2.
2015-02-17 08:09:46 -05:00
Tim Graham 81a94cc616 Refs #24324 -- Fixed makemessages crash when Django is installed in a non-ASCII path. 2015-02-17 08:06:33 -05:00
Tim Graham 4a0aeac1b5 Refs #24324 -- Fixed management command discovery on non-ASCII paths. 2015-02-17 07:27:47 -05:00
Tim Graham 3adc5f1ee6 Fixed #24335 -- Bumped required psycopg2 version to 2.4.5 (2.5 for contrib.postgres). 2015-02-16 18:07:27 -05:00
Tim Graham 664c038f2c Moved contrib.contenttypes tests out of contrib. 2015-02-16 17:45:38 -05:00
Tim Graham 4538cbf17d Fixed #24299 -- Added an auth migration to ensure contenttypes is migrated.
Without this migration, the auth signal handlers will fail if migrating
only auth.
2015-02-16 14:52:30 -05:00
Sergey Fedoseev d392c1e150 Refs #24299 -- Made contenttypes migrations signal handler more robust. 2015-02-16 13:36:53 -05:00
Markus Holtermann b29f3b5120 Fixed #24225, #24264, #24282 -- Rewrote model reloading in migration project state
Instead of naively reloading only directly related models (FK, O2O, M2M
relationship) the project state needs to reload their relations as well
as the model changes as well. Furthermore inheriting models (and super
models) need to be reloaded in order to keep inherited fields in sync.

To prevent endless recursive calls an iterative approach is taken.
2015-02-16 19:31:51 +01:00
Preston Timmons ad9ecc2c20 Removed unnecessary __init__ definition from DebugLexer. 2015-02-16 19:00:02 +01:00
Markus Holtermann 4dd1f4c5eb Explicitly checked for LookupError in contenttypes migration 2015-02-16 17:08:19 +01:00
Loic Bistuer 5efd472178 Reworked docstrings and comments in related.py.
Thanks Tim Graham for the review.
2015-02-16 20:40:04 +07:00
Loic Bistuer c5a77721e2 Merged ManyRelatedObjectsDescriptor and ReverseManyRelatedObjectsDescriptor
and made all "many" related objects descriptors inherit from
ForeignRelatedObjectsDescriptor.
2015-02-16 20:40:04 +07:00
Aymeric Augustin 15b711b5ee Deprecated TEMPLATE_DEBUG setting. 2015-02-15 20:47:04 +01:00
Michael Angeletti 49647bec6e Added missing return value to DurationField.prepare_value(); refs #24339. 2015-02-14 18:38:50 -05:00
Aymeric Augustin a73c8540a8 Removed 'autocommit' options for the psycopg2 backend.
It was documented as not having any effect since Django 1.6.
2015-02-14 18:51:18 +01:00
Aymeric Augustin 28e97a9bdc Cleaned up init_connection_state in the psycopg2 backend.
settings_dict['TIME_ZONE'] is set in ConnectionHandler.ensure_defaults.
2015-02-14 18:51:18 +01:00
Aymeric Augustin 76356d963c Fixed #24318 -- Set the transaction isolation level with psycopg >= 2.4.2. 2015-02-14 18:51:11 +01:00
Michael Angeletti 8a21d25033 Fixed #24339 -- Fixed crash with empty DurationField form field. 2015-02-14 07:37:18 -05:00
Claude Paroz 1791a7e75a Fixed #15779 -- Allowed 'add' primary key in admin edition
Thanks Marwan Alsabbagh for the report, and Simon Charette and
Tim Graham for the reviews.
2015-02-14 11:19:55 +01:00
Aymeric Augustin 47ee7b48ad Fixed #24338 -- Accepted Template wrapper in {% extends %}.
Explicitly checking for django.template.Template subclasses is
preferrable to duck-typing because both the django.template.Template and
django.template.backends.django.Template have a render() method.

Thanks spectras for the report.
2015-02-14 10:21:06 +01:00
Loic Bistuer 18c0aaa912 Fixed #24289 -- Reversed usage of Field.many_to_one and one_to_many.
Thanks Carl Meyer and Tim Graham for the reviews and to all involved
in the discussion.
2015-02-14 02:28:24 +07:00
Andriy Sokolovskiy 5c995dcfc2 Fixed #24320 - Used field.value_to_string() in serialization of foreign key.
This fixes serialization of a ForeignKey to a UUIDField as the
test indicates.
2015-02-13 12:37:23 -05:00
Tim Graham 002425fe39 Fixed #24315 -- Fixed auth.views.password_reset_confirm() with a UUID user. 2015-02-13 09:56:31 -05:00
Tim Graham fdf20093e0 Fixed #24334 -- Allowed admin password reset to work with non-digit custom user model primary key.
Thanks Loic for help and Simon for review.
2015-02-13 09:42:49 -05:00
Markus Holtermann f287bec583 Fixed #24184 -- Prevented automatic soft-apply of migrations
Previously Django only checked for the table name in CreateModel
operations in initial migrations and faked the migration automatically.
This led to various errors and unexpected behavior. The newly introduced
--fake-initial flag to the migrate command must be passed to get the
same behavior again. With this change Django will bail out in with a
"duplicate relation / table" error instead.

Thanks Carl Meyer and Tim Graham for the documentation update, report
and review.
2015-02-13 14:29:59 +01:00
Loic Bistuer 00a889167f Fixed #24295 -- Allowed ModelForm meta to specify form field classes.
Thanks Carl Meyer and Markus Holtermann for the reviews.
2015-02-13 19:13:05 +07:00
Tim Graham e8cf4f8abe Fixed #24332 -- Fixed contrib.sites create_default_site() when 'default' DATABASES is empty. 2015-02-13 07:01:28 -05:00
Josh Smeaton de0241eb98 Fixed #24319 -- Added validation for UUID model field 2015-02-13 09:45:53 +11:00
Tim Graham d64baaef3b Fixed #24333 -- Fixed admin history view crash with non-integer slug. 2015-02-12 14:19:44 -05:00
Simon Charette 9239f1dda7 Refs #24215 -- Prevented pending lookup pollution by abstract models. 2015-02-12 13:07:09 -05:00
Tim Graham 27eeb64a96 Fixed #17716 -- Prevented include('...', app_name='...') without a namespace. 2015-02-12 08:07:58 -05:00
Nik Nyby 34ccb3cc03 Subclassed template.Node instead of Node for consistency. 2015-02-12 08:04:30 -05:00
Tim Graham 0f7f5bc9e7 Fixed #24161 -- Stored the user primary key as a serialized value in the session.
This allows using a UUIDField primary key along with the JSON session
serializer.

Thanks to Trac alias jamesbeith for the report and Simon Charette
for the initial patch.
2015-02-12 07:38:16 -05:00
Lukas Klein 93b3ef9b2e Fixed #24321 -- Improved `utils.http.same_origin` compliance with RFC6454 2015-02-12 08:58:35 +01:00
Josh Smeaton e2d6e14662 Refs #14030 -- Improved expression support for python values 2015-02-12 08:46:25 +11:00
Collin Anderson 07cfe1bd82 Refs #14497 -- Handled empty readonly admin FileFields 2015-02-11 13:00:56 -05:00
Tim Graham 8ec306a3a9 Moved contrib.webdesign tests out of contrib. 2015-02-11 12:30:07 -05:00
Tim Graham ad0be620ae Moved contrib.gis tests out of contrib. 2015-02-11 10:29:54 -05:00
Tim Graham 5ab327a389 Moved non-documented auth test models to the new test location. 2015-02-11 10:29:48 -05:00
Tim Graham 2d7aca3da0 Moved contrib.auth tests out of contrib. 2015-02-11 10:19:22 -05:00
Tim Graham 8192a164de Moved contrib.humanize tests out of contrib. 2015-02-11 10:19:22 -05:00
Tim Graham 00da46091a Moved contrib.redirects tests out of contrib. 2015-02-11 10:19:22 -05:00
Tim Graham b3cd9e0d07 Moved contrib.messages tests out of contrib. 2015-02-11 10:19:22 -05:00
Tim Graham fac3a34cbb Moved contrib.sessions tests out of contrib. 2015-02-11 10:19:22 -05:00
Tim Graham fbc467c26b Moved contrib.sitemaps tests out of contrib. 2015-02-11 10:19:22 -05:00
Tim Graham d8341bf024 Moved contrib.sites tests out of contrib. 2015-02-11 10:19:22 -05:00
Tim Graham d3a725054f Moved contrib.flatpages tests out of contrib. 2015-02-11 10:19:22 -05:00
Tim Graham 197dd4b8f1 Prevented some test commands from needlessly running system checks.
This is a performance optimization and also fixes test errors with the
upcoming merge of contrib tests into tests/. The tests failed on MySQL
because the models with GeometryField were being checked but the
non-GIS MySQL backend didn't know how to handle them.
2015-02-11 10:14:38 -05:00
Daniel Pyrathon 19188826b4 Fixed #24146 -- Allowed model._meta.get_field() to be used after apps.models_ready 2015-02-10 19:55:06 -05:00
Josh Smeaton 1fbe8a2de3 Fixed #24200 -- Made introspection bypass statement cache 2015-02-10 23:24:34 +02:00
Aymeric Augustin 1b8af4cfa0 Disallowed importing concrete models without an application.
Removed fragile algorithm to find which application a model belongs to.

Fixed #21680, #21719. Refs #21794.
2015-02-10 21:41:19 +01:00
Aymeric Augustin c7a6996df7 Fixed a crash of the debug page.
During the autumn DST change, the template engine would fail to convert
the naive representation of now when USE_TZ = True. Passing now in UTC
eliminates the issue.

Thanks mbertheau and tricoder42.

Refs #23714.
2015-02-10 21:37:53 +01:00
Loic Bistuer c8e24bbc9b Fixed isort import that's inconsistent between platforms. 2015-02-11 02:24:14 +07:00
Aymeric Augustin f2c104ada6 Split DTL context creation into its own function.
This reduces the length of rope RequestContext gives users to hang
themselves with.

Thanks Alex Hill for the report and Tim Graham for the review.
2015-02-10 14:34:05 +01:00
Tim Graham c970018f41 Removed Django 1.7 MIDDLEWARE_CLASSES upgrade check. 2015-02-09 19:16:07 -05:00
Tim Graham 2ee9bce654 Removed some obsolete absolute_imports. 2015-02-09 13:37:23 -05:00
Claude Paroz 50aa1a790c Replaced some more hardcoded admin URLs 2015-02-09 17:29:53 +01:00
Tim Graham 2d7c27d387 Fixed #24302 -- Added DurationField.formfield() 2015-02-09 10:20:01 -05:00
Daniel Wiesmann 32ed4c202f Moved numpy import helper to shortcuts
Numpy will be used in both the geos and gdal modules,
so the import should sit in the parent module gis.
2015-02-09 15:51:19 +01:00
Tim Graham e144e0e237 Removed unnecessary parentheses in model check messages. 2015-02-09 08:53:58 -05:00
Aron Podrigal 4d73303ee9 Fixed #24249 -- Improved field shadowing validation in model multi-inheritance. 2015-02-09 08:37:55 -05:00
я котик пур-пур 981bd64dfb Unified local imports in django.db.backends.mysql. 2015-02-09 08:23:17 -05:00
Tim Graham 1256274750 Removed stray comment in auth.views. 2015-02-09 07:50:47 -05:00
Alex Gaynor 8099d33b65 Simplified the lazy CSRF token implementation in csrf context processor.
This significantly improves performance on PyPy. The previous
implementation would generate a new class on every single request,
which is relatively slow.
2015-02-08 15:02:43 -05:00
Alex Gaynor 82e0cd1571 Optimized allow_lazy() by not generating a new lazy wrapper on each invocation.
This dramatically improves performance on PyPy. The following benchmark:

python -mtimeit -s "from django.utils.functional import allow_lazy; from django.utils.translation import ugettext_lazy; f = allow_lazy(lambda s: s, str)" "f(ugettext_lazy('abc'))"

goes from 390us per loop to 165us.
2015-02-08 14:56:57 -05:00
Claude Paroz 32e6a7d3a5 Replaced hardcoded URLs in admin_* tests
Refs #15779. This will allow easier admin URL changes, when needed.
Thanks Simon Charette for the review.
2015-02-08 20:55:09 +01:00
Tim Graham 9033003d97 Added check_apps_ready() to Apps.get_containing_app_config() 2015-02-08 14:52:19 -05:00
Varun Sharma 540ca563de Fixed #24181 -- Fixed multi-char THOUSAND_SEPARATOR insertion
Report and original patch by Kay Cha.
2015-02-08 20:00:57 +01:00
Markus Holtermann 2832a9b028 Revert "Fixed #24075 -- Prevented running post_migrate signals when unapplying initial migrations of contenttypes and auth"
This reverts commit 737d24923a.
2015-02-07 20:14:49 +01:00
Markus Holtermann bd3d796ecd Revert "Refs #24075 -- Silenced needless call_command output while running tests"
This reverts commit 51dc617b21.
2015-02-07 19:22:31 +01:00
Collin Anderson db77915c9f Fixed E265 comment style 2015-02-06 09:30:35 -05:00
Tim Graham eb45a29565 Removed bin/unique-messages.py
This script is no longer used according to Claude, our translations manager.
2015-02-06 08:47:38 -05:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham 388d986b8a Removed gather_profile_stats.py
This script uses the unmaintained hotshot module (gone on Python 3)
and doesn't seem to be Django specific in any way.
2015-02-06 07:58:31 -05:00
Tim Graham 607af78bb8 Removed django-2to3.py
Aymeric says, "It was fun to write, but I don't think it's very useful."
2015-02-06 06:22:00 -05:00
Tim Graham bbe28496d3 Removed old import aliases. 2015-02-05 19:37:01 -05:00
Tim Graham 0f54cf28c0 Added UUIDField.deconstruct() 2015-02-05 19:15:02 -05:00
Aymeric Augustin 146dd7be8d Called parent in SimpleTestCase.setUpClass/tearDownClass. 2015-02-05 21:27:25 +01:00
Aymeric Augustin 44ad691558 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.
2015-02-05 20:06:18 +01:00
Aymeric Augustin 27f9ff459b Caught all exceptions raised by Engine.get_default().
In addition to ImproperlyConfigured, Engine.get_default() may also raise
ImportError or other exceptions. It's better to catch all exceptions in
places where the default engine isn't strictly required.
2015-02-05 20:06:18 +01:00
Aymeric Augustin 31d3a35579 Fixed #24273 -- Allowed copying RequestContext more than once.
Thanks Collin Anderson for the report.
2015-02-05 13:21:50 +01:00
Aymeric Augustin de62b8ef45 Simplified handling of RegexURLResolver.urlconf_module.
Also made RegexURLResolver.url_patterns a cached property for
consistency and efficiency.
2015-02-05 12:43:55 +01:00
Loic Bistuer 20eb51ce0d Fix small regression caused by 71ada3a8e6.
During direct assignment, evaluating the iterable before the transaction
is started avoids leaving the transaction dirty if an exception is raised.
This is slightly more wasteful but probably not enough to warrant a change
of behavior.

Thanks Anssi for the feedback. Refs #6707.
2015-02-05 16:59:56 +07:00
Loic Bistuer 71ada3a8e6 Fixed #6707 -- Added RelatedManager.set() and made descriptors' __set__ use it.
Thanks Anssi Kääriäinen, Carl Meyer, Collin Anderson, and Tim Graham for the reviews.
2015-02-05 12:45:08 +07:00
Matthew Somerville caa3562d5b 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.
2015-02-04 13:04:00 -05:00
mlavin 2730dad0d7 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.
2015-02-04 10:53:04 -05:00
Tim Graham 4444ff39a4 Removed direct manipulation of settings in auth tests; refs #21230. 2015-02-04 09:56:55 -05:00
Anssi Kääriäinen 4d3470e52e Removed non-used EmptyShortCircuit 2015-02-04 09:26:40 -05:00
Anssi Kääriäinen 7145c8a62a Removed EverythingNode
At the same time, made sure that empty nodes in where clause match
everything.
2015-02-04 09:26:40 -05:00
Anssi Kääriäinen afe0bb7b13 Fixed #24268 -- removed Query.having
Instead of splitting filter clauses to where and having parts before
adding them to query.where or query.having, add all filter clauses to
query.where, and when compiling the query split the where to having and
where parts.
2015-02-04 09:26:40 -05:00
Riccardo Magliocchetti 2be621e44c Fixed #14497 -- Improved admin widget for "read only" FileFields
Based on patch by Adam J Forster, Paul Collins, and Julien.
2015-02-04 09:05:23 -05:00
Preston Timmons 5bc5ddd8b5 Fixed #24235 -- Removed is_usable attribute from template loaders. 2015-02-04 07:47:28 -05:00
Aron Podrigal 79f27f2b61 Fixed #15321 -- Honored ancestors unique checks.
Thanks to Tim for the review.
2015-02-03 18:56:53 -05:00
Simon Charette 65e005f8cd 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.
2015-02-03 16:40:31 -05:00
Tim Graham 0e489c19f1 Reverted "Fixed #24146 -- Fixed a missing fields regression in admin checks."
This reverts commit e8171daf0c.

A new solution is forthcoming.
2015-02-03 15:23:39 -05:00
darkryder 9ec8aa5e5d Fixed #24149 -- Normalized tuple settings to lists. 2015-02-03 14:59:45 -05:00
Claude Paroz cd0ceaa102 Fixed #24252 -- Forced lazy __str__ to utf-8 on Python 2
Thanks Stanislas Guerra for the report and Tomas Ehrlich for
the review.
2015-02-03 18:23:41 +01:00
Matthew Somerville 250aa7c39b 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.
2015-02-03 18:18:12 +01:00
Preston Timmons cd4282816d Fixed #18651 -- Enabled optional assignments for simple_tag(). 2015-02-03 10:44:33 -05:00
Anssi Kääriäinen 8adc59038c 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.
2015-02-03 09:23:44 -05:00
Tim Graham 118b11221f Fixed #24263 -- Prevented extra queries on BaseDateDetailView with a custom queryset.
Thanks jekka-ua for the report and patch.
2015-02-03 09:12:37 -05:00
Aymeric Augustin 2133f3157e 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.
2015-02-03 08:29:45 +01:00
Tim Graham a53541852d Removed contrib.auth.forms.mask_password()
This function is unused since dce820ff70
after being introduced in 718a5ba1a1
2015-02-02 11:13:14 -05:00
Tim Graham f79ce63fdb Removed query.alias_diff()
This function is unused since 6fe2b001db
2015-02-01 21:37:25 -05:00
Tim Graham 0e60912492 Removed UpdateCacheMiddleware._session_accessed()
This method is unused since f567d04b24
2015-02-01 20:33:22 -05:00
Tim Graham 99ca7c2bd3 Removed Query.raise_field_error()
This method was inadvertently reintroduced in
f59fd15c49
2015-02-01 20:26:04 -05:00
Tim Graham 327a00f48b Removed InlineAdminForm.field_count()
This method is unused since 337d102b86
2015-02-01 20:13:12 -05:00
Tim Graham 75303b01a9 Fixed #24245 -- Added introspection for database defaults.
Needed for tests for migrations handling of database defaults.
2015-01-31 12:33:11 -05:00
Tim Graham 64a899dc81 Removed PostgreSQL DatabaseWrapper._set_isolation_level().
This method is unused since 8717b0668c.
2015-01-31 11:05:26 -05:00
Claude Paroz a0b5f15ea5 Fixed #14483 -- Allowed using subqueries with GIS lookups 2015-01-30 20:27:18 +01:00
Tim Graham 293fd5da5b 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.
2015-01-30 12:51:12 -05:00
Loic Bistuer 4c3bfe9053 Fixed #24211 -- Removed ValuesQuerySet() and ValuesListQuerySet().
Thanks Anssi Kääriäinen, Marc Tamlyn, and Tim Graham for the reviews.
2015-01-30 22:02:58 +07:00
Tim Graham 29c0073335 Fixed #24164 -- Fixed Oracle GIS limited aggregation test failure. 2015-01-30 06:28:47 -05:00
Samuel Colvin 5b74134f27 Fixed #24145 -- Added PUT & PATCH to CommonMiddleware APPEND_SLASH redirect error. 2015-01-29 15:23:01 -05:00
Simon Charette eb4cdfbdd6 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.
2015-01-29 14:40:20 -05:00
Matt 55c76f4e3b Fixed #24223 -- Prevented a session test from leaking. 2015-01-29 14:36:01 -05:00
Tim Graham f609731118 Removed ForeignObjectRel.get_lookup_constraint() [unused]. 2015-01-29 13:31:12 -05:00
Reza Mohammadi f1ff9407c9 Fixed Persian locale FIRST_DAY_OF_WEEK & DECIMAL/THOUSAND_SEPARATORs.
Reference: http://lh.2xlibre.net/locale/fa_IR/
2015-01-29 12:55:20 -05:00
Tim Graham 18f3e79b13 Removed threading fallback imports.
Django imports threading in many other places without fallback.
2015-01-28 10:23:25 -05:00
Jon Dufresne 24b2bc635e Fixed #24137 -- Switched to HTTP reason phrases from Python stdlib. 2015-01-28 06:59:40 -05:00
Emin Mastizada 0f3ea8c0bc Updated Azerbaijani language name. 2015-01-28 06:48:09 -05:00