Commit Graph

6766 Commits

Author SHA1 Message Date
Anssi Kääriäinen 8f30556329 Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field
attribute. This means that self == self.remote_field.remote_field.

In addition, made the Rel objects a bit more like Field objects. Still,
marked ManyToManyFields as null=True.
2015-03-25 08:16:12 -04:00
Anssi Kääriäinen b68212f539 Refs #24267 -- Implemented lookups for related fields
Previously related fields didn't implement get_lookup, instead
related fields were treated specially. This commit removed some of
the special handling. In particular, related fields return Lookup
instances now, too.

Other notable changes in this commit is removal of support for
annotations in names_to_path().
2015-03-25 08:05:22 -04:00
Michael Blatherwick 8654c6a732 Refs #18586 -- Split up tests.m2m_through_regress 2015-03-24 12:54:16 -04:00
David Szotten 80e3444eca Fixed #24483 -- Prevented keepdb from breaking with generator choices.
If Field.choices is provided as an iterator, consume it in __init__ instead
of using itertools.tee (which ends up holding everything in memory
anyway). Fixes a bug where deconstruct() was consuming the iterator but
bypassing the call to `tee`.
2015-03-24 11:42:53 -04:00
Tim Graham 13bc311cdb Removed getLogger alias in django.utils.log. 2015-03-24 08:41:05 -04:00
Claude Paroz 01ec127bae Fixed #12400 -- Allowed geometry fields in unique_together
Thanks Tim Graham for the review.
2015-03-23 19:52:49 +01:00
Baptiste Mispelon 1aadade373 Fixed #24521 -- Added support for serializing frozensets in migrations. 2015-03-23 15:38:25 +01:00
Michael Blatherwick 00e667728b Fixed #23697 -- Improved ForeignObject.get_lookup_constraint() error message. 2015-03-23 10:31:57 -04:00
Bas Peschier b4382b7055 Fixed #16362 -- Allowed lookaround assertions in URL patterns. 2015-03-23 09:00:07 -04:00
Varun Sharma 74f8110e74 Added test for LogEntry.get_edited_object(); refs #24244. 2015-03-23 08:51:43 -04:00
Bas Peschier 23a5d64f40 Fixed #13525 -- Added tests and docs for nested parameters in URL patterns.
When reversing, only outer parameters are used if captured parameters are
nested. Added tests to check the edge cases and documentation for the
behavior with an example to avoid it.
2015-03-23 08:43:01 -04:00
Berker Peksag f2e4d39a71 Switched to use assertEqual instead of assertEquals. 2015-03-22 10:56:51 -04:00
Alain IVARS 82ec05fcc9 Refs #18586 -- Split up tests/m2m_signals 2015-03-22 13:21:08 +01:00
Josh Smeaton 02a2943e4c Fixed #24485 -- Allowed combined expressions to set output_field 2015-03-22 17:36:55 +11:00
Josh Smeaton 127b3873d0 Fixed #24508 -- Made annotations commutative 2015-03-22 17:28:42 +11:00
Claude Paroz a6bada1ee0 Revert "Removed unneeded app_label definitions in gis_tests"
This reverts commit e0cc36f615.
The problem is the following:
  * With non-gis backends, gis_tests sub apps are not discovered
    (see runtests.py)
  * Consequently, the app_label is inferred from the gis_tests
    AppConfig
  * Then models with same names in different sub apps conflict
    because of same model_name/app_label pair.
2015-03-21 16:59:30 +01:00
Claude Paroz e0cc36f615 Removed unneeded app_label definitions in gis_tests 2015-03-21 16:10:24 +01:00
Jon Dufresne 966a29c2b8 Fixed #24479 -- Added system check to prevent both ordering and order_wrt. 2015-03-21 08:16:28 -04:00
Claude Paroz 9e83f30cd3 Fixed #24515 -- Fixed DjangoTranslation plural handling 2015-03-21 10:27:30 +01:00
Karl Hobley aea02ddfb7 Fixed #24490 -- Set LogEntry.change_message when adding an object. 2015-03-20 18:25:06 -04:00
Tim Graham a3e75f6bed Removed unused imports. 2015-03-20 17:57:11 -04:00
Moritz Sichert 6bb2175ed6 Fixed #22106 -- Allowed using more than one instance of javascript_catalog per project. 2015-03-20 17:27:41 -04:00
Claude Paroz ba37ac749e Adapted sendtestemail to be more argparse-ish 2015-03-20 20:40:35 +01:00
Daniel Wiesmann 0d9b018e07 Fixed gis test failures when numpy isn't installed.
Thanks to Bas Peschier for pointing this out. Refs #23804.
2015-03-20 13:42:55 -04:00
Tim Graham 4a5d967dfe Removed unused import. 2015-03-20 13:31:49 -04:00
Tim Graham 7bf775258e Used testing domain names in mail tests per rfc2606. 2015-03-20 12:19:14 -04:00
Loek van Gent d898ba1bec Fixed #24419 -- Added sendtestemail management command 2015-03-20 12:03:50 -04:00
Preston Timmons 55f12f8709 Cleaned up the template debug implementation.
This patch does three major things:

* Merges the django.template.debug implementation into django.template.base.

* Simplifies the debug implementation.

  The old implementation copied debug information to every token and node.
  The django_template_source attribute was set in multiple places, some
  quite hacky, like django.template.defaulttags.ForNode.

  Debug information is now annotated in two high-level places:

  * Template.compile_nodelist for errors during parsing
  * Node.render_annotated for errors during rendering

  These were chosen because they have access to the template and context
  as well as to all exceptions that happen during either the parse or
  render phase.

* Moves the contextual line traceback information creation from
  django.views.debug into django.template.base.Template. The debug views now
  only deal with the presentation of the debug information.
2015-03-20 08:58:07 -04:00
Yair Chuchem eb5ebcc2d0 Fixed #24285 -- Made for_user argument optional for {% get_admin_log %} tag 2015-03-20 08:32:25 -04:00
Loek van Gent 35b3158d52 Fixed #24417 -- Added ModelAdmin.get_list_select_related() 2015-03-19 08:52:28 -04:00
Tim Graham 011a54315e Made is_safe_url() reject URLs that start with control characters.
This is a security fix; disclosure to follow shortly.
2015-03-18 19:20:07 -04:00
Tim Graham 1c83fc88d6 Fixed an infinite loop possibility in strip_tags().
This is a security fix; disclosure to follow shortly.
2015-03-18 19:20:07 -04:00
Karl Hobley 81e1a35c36 Fixed #24495 -- Allowed unsaved model instance assignment check to be bypassed. 2015-03-18 19:00:09 -04:00
Claude Paroz 65129aac07 Fixed #23757 -- Added 3D introspection support to Spatialite backend
Thanks Tim Graham for the review.
2015-03-18 19:27:44 +01:00
Tim Graham b4a56ed4f5 Refs #24483 -- Added a test for deconstruction of Field.choices 2015-03-18 13:39:52 -04:00
Claude Paroz a0c2eb46dd Fixed #23960 -- Removed http.fix_location_header
Thanks Carl Meyer for the report and Tim Graham for the review.
2015-03-18 18:22:50 +01:00
Bas Peschier 0339844b70 Fixed #24476 -- Added context manager/decorator for overriding script prefix.
Tests were using an undocumented keyword argument for easily overriding
script prefix while reversing. This is now changed into a test utility
which can be used as decorator or context manager.
2015-03-18 13:03:25 -04:00
Moritz Sichert 6bff343989 Refs #24469 -- Fixed escaping of forms, fields, and media in non-Django templates. 2015-03-18 09:11:01 -04:00
Josh Smeaton 88d798d71a Refs #24485 -- Renamed some expression types 2015-03-17 08:40:18 -04:00
Josh Smeaton ff2aa40192 Fixed #24486 -- Fixed error with datetime and DurationField arithmetic 2015-03-17 08:35:49 -04:00
Andriy Sokolovskiy 81c2d9f60b Fixed #15579 -- Added ability to delete only child models in multi-table inheritance. 2015-03-17 08:33:16 -04:00
Daniel Wiesmann b9cb81570e Made SRID a required parameter for GDALRaster instantiation; refs #23804.
Earlier versions of GDAL do not allow the srid to be set to 0,
so it should be a required parameter to ensure compatibility.
2015-03-17 08:16:12 -04:00
Daniel Wiesmann f269c1d6f6 Added write support for GDALRaster
- Instantiation of GDALRaster instances from dict or json data.
- Retrieve and write pixel values in GDALBand objects.
- Support for the GDALFlushCache in gdal C prototypes
- Added private flush method to GDALRaster to make sure all
  data is written to files when file-based rasters are changed.
- Replaced ``ptr`` with ``_ptr`` for internal ptr variable

Refs #23804. Thanks Claude Paroz and Tim Graham for the reviews.
2015-03-16 19:37:43 +01:00
John Giannelos 8758a63ddb Fixed #24427 -- Stopped writing migration files in dry run mode when merging.
Also added display of migration to stdout when verbosity=3.
2015-03-16 14:04:37 -04:00
Marten Kenbeek 818182b514 Fixed #24488 -- Made create_default_site() use default pk of 1.
Fixed create_default_site() to use a default value in case
settings.SITE_ID isn't set; refs #23945.
2015-03-16 13:30:59 -04:00
Preston Timmons 388e79e9fc Fixed #24493 -- Added BaseContext.setdefault() 2015-03-16 13:13:02 -04:00
Joeri Bekker 0ed20d5cc4 Fixed #23926 -- Improved validation error for custom permissions that are too long. 2015-03-16 12:13:49 -04:00
Thomas Tanner 28986da4ca Fixed #5986 -- Added ability to customize order of Form fields 2015-03-16 09:12:57 -04:00
Tomáš Ehrlich 8414fcf16b Fixes #23643 -- Added chained exception details to debug view. 2015-03-14 16:08:23 -04:00
Matthew Wilkes ae87ad005f Refs #24354 -- Prevented repointing of relations on superclasses when migrating a subclass's name change
Forwardport of test and release note from stable/1.7.x
2015-03-14 15:37:40 -04:00
Berker Peksag 34fb909180 Fixed #12982 -- Added a get_or_set() method to the BaseCache backend. 2015-03-14 20:07:16 +02:00
medmunds 5993b52e6d Fixed #24416 -- Added support for lazy email addresses. 2015-03-13 12:33:49 -04:00
Claude Paroz aa5ab114e3 Fixed #24122 -- Redirected to translated url after setting language
Thanks gbdlin for the initial patch and Tim Graham for the review.
2015-03-13 16:46:40 +01:00
Jon Dufresne d861f95c44 Fixed #24139 -- Changed HttpResponse.reason_phrase to evaluate based on status_code. 2015-03-12 20:18:06 -04:00
Bas Peschier a23ea398e8 Cleaned up urlpatterns_reverse tests. 2015-03-12 19:13:48 -04:00
Bas Peschier c9f1a12925 Fixed #24013 -- Fixed escaping of reverse() prefix.
Prefix was treated as a part of the url pattern, which it is not.
Improved tests to conform with RFC 3986 which allows certain
characters in path segments without being escaped.
2015-03-12 19:05:17 -04:00
Tim Graham e4a578e70e Fixed #24226 -- Changed admin EMPTY_CHANGELIST_VALUE from (None) to - 2015-03-12 09:40:56 -04:00
Bas Peschier f0f5212624 Fixed #12943 -- Allowed unnamed arguments to be propagated in includes
Propagated unnamed arguments as positional arguments into included
URLconfs if no named arguments are defined. Positional and keyword
arguments are never combined.
2015-03-12 09:18:39 -04:00
Tim Graham 8a481498aa Fixed #24468 -- Made signed cookies cache backend resilient to unpickling exceptions. 2015-03-12 08:19:54 -04:00
Tim Graham 389baccac5 Fixed staticfiles test on Windows; refs #23986. 2015-03-11 14:49:15 -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 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
Baptiste Mispelon 82c9169077 Refs #24461 -- Added test/release notes for XSS issue in ModelAdmin.readonly_fields
This issue was fixed by refs #24464.
2015-03-09 10:12:21 -04: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
Sztrovacsek 87d78241a2 Fixed #23986 -- Fixed collectstatic --clear failure if STATIC_ROOT dir doesn't exist. 2015-03-07 10:47:07 -05:00
Aymeric Augustin 90b069c33f Prevented some tests from writing in the CWD. 2015-03-07 15:56:15 +01: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
Tim Graham 82f7bee1d5 Fixed admin selenium tests broken by removal of fixtures. 2015-03-05 17:51:17 -05:00
Grzegorz Slusarek 668d53cd12 Fixed #21495 -- Added settings.CSRF_HEADER_NAME 2015-03-05 15:03:40 -05:00
Preston Timmons fb7d681705 Fixed test_notafile_error to pass on Windows.
This test failed because a different error code is raised on Windows when
opening a directory. Since the particular message isn't as important to this
test as the fact that the original IOError is reraised, this fixes the test
by making the assertion more generic.
2015-03-05 12:14:19 -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 b4a1bb8669 Updated test to be date-independent
Fixes commit 8714403614.
2015-03-05 10:08:39 +01: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
Josh Smeaton 39a7eed1bb Converted test fixtures to setUpTestData methods 2015-03-05 10:10:32 +11:00
Tim Graham 36a17be9f3 Fixed #24426 -- Displayed admin actions panel when show_full_result_count=False. 2015-03-04 12:00:12 -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
Preston Timmons 358850781f Fixed #24372 - Replaced TokenParser usage with traditional parsing. 2015-03-02 18:25:28 -05:00
Shai Berger 8ca35d7c6a Fixed Oracle build failure introduced by refs #24390.
Used shorter column names to make the generated index name
fit within Oracle's limit of 30 characters
2015-03-03 00:01:21 +02: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
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 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
Claude Paroz 8a9f39d2b3 Removed binary input test line
That line was inconveniently introduced by the committer (me) in
3b966c2b73. Sorry!
2015-02-27 15:44:06 +01:00
Jon Dufresne 3b966c2b73 Fixed #24229 -- Changed IntegerField to clean floats representing integers 2015-02-27 12:23:21 +01: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
Preston Timmons 8e129b42ad Cleaned up template directory handling in template tests. 2015-02-24 14:00:03 +01:00
Preston Timmons 32c108a221 Combined TemplateTests and TemplateRegressionTests. 2015-02-24 14:00:03 +01:00
Preston Timmons 25a0b5cdcd Moved test_token_smart_split into ParserTests. 2015-02-24 14:00:03 +01:00
Preston Timmons 3d8fee6051 Moved ifchanged tests into syntax_tests/test_if_changed.py. 2015-02-24 14:00:02 +01:00
Preston Timmons f6d087b628 Moved cache tests into syntax_tests/test_cache.py. 2015-02-24 14:00:02 +01:00
Preston Timmons 250a3d1993 Moved RequestContextTests into test_context. 2015-02-24 14:00:02 +01:00
Preston Timmons ff67ce5076 Moved TemplateTagLoading cases into test_custom. 2015-02-24 14:00:02 +01:00
Preston Timmons 06ffc764a9 Moved include tests into syntax_tests/test_include.py. 2015-02-24 14:00:02 +01:00
Preston Timmons 441a47e1ef Moved ssi tests into syntax_tests/test_ssi.py. 2015-02-24 14:00:02 +01:00
Preston Timmons 1827aa9024 Cleaned up template loader tests. 2015-02-24 14:00:02 +01:00
Nik Nyby 2be6b52656 Fixed typos in flatpages_tests comments. 2015-02-24 06:30:33 -05:00
Aymeric Augustin 903d1a57ab Made migrations tests write to a temporary directory.
This is preferrable to writing in the current working directory because
it eliminates the risk to leak unwanted files, which can result in very
weird test failures.

Also this will help if we ever try to run these tests concurrently.
2015-02-23 22:22:58 +01:00
Aymeric Augustin 952ce778c6 Fixed a test failure under Windows and Python 2. 2015-02-23 18:36:15 +01:00
Aymeric Augustin a8fe12417f Normalized usage of the tempfile module.
Specifically stopped using the dir argument.
2015-02-23 16:55:27 +01:00
Aymeric Augustin 934400759d Guaranteed removal of temporary files during tests.
Dropped the DJANGO_TEST_TEMP_DIR environment variable.

Before this change, proper removal depended on the developer passing
dir=os.environ['DJANGO_TEST_TMP_DIR'] to tempfile functions.
2015-02-23 16:55:26 +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
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
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
Aymeric Augustin 787dd6519a Removed obsolete reference to media directory. 2015-02-21 17:52:24 +01:00
Aymeric Augustin bd059e3f8c Removed workaround for SVN limitations.
In addition to simplifying the code, this reduces the number of writes.
2015-02-21 17:52:24 +01:00
Aymeric Augustin 2bb5b0e098 Avoided collecting admin static files in tests.
This makes the staticfiles tests 2.5 times faster.
2015-02-21 17:46:26 +01:00
Aymeric Augustin 1d9d39fa1c Removed TestServeAdminMedia.
It should have been removed when the ADMIN_MEDIA_PREFIX setting was deprecated.
2015-02-21 17:46:26 +01:00
Loic Bistuer fa5f936b48 Fixed allow_migrate signature in one of the tests.
Refs #24351.
2015-02-21 23:13:14 +07:00
foresmac 1d1d5d1c31 Fixed #24341 -- Added specific error messages to RangeField subclasses 2015-02-20 16:49:15 -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
Tim Graham c8074d62f8 Fixed typo in error message in the test. 2015-02-19 19:36:20 -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
Shai Berger f7d34fe741 Fixed #24362: Made test run each migration operation in its own schema editor
Thanks Tim Graham for pointing out the fix.
2015-02-18 22:47:15 +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
Tim Graham b8d6cdbcc9 Refs #24324 -- Skipped fixtures_regress tests that fail on Python 2 on a non-ASCII path. 2015-02-18 07:25:36 -05:00
Tim Graham 307c0f299a Refs #24324 -- Fixed Python 2 test failures when path to Django source contains non-ASCII characters. 2015-02-17 19:03:03 -05:00
Tim Graham ad50b6c853 Fixed "environment can only contain strings" in model_regress test on Windows. 2015-02-17 13:54:18 -05:00
Tim Graham d316b43d0a Refs #24324 -- Fixed UnicodeDecodeError in model_regress test on non-ASCII path. 2015-02-17 07:32:48 -05:00
Tim Graham 8b39f33d78 Fixed #24290 -- Skipped postgres_tests if not running with PostgreSQL. 2015-02-17 06:34:13 -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
Markus Holtermann d538e37e1b Added tests for get_related_models_recursive 2015-02-16 19:31:52 +01:00
Markus Holtermann 273bc4b667 Refs #24282 -- Added failing test case for assigning models of wrong type to FK
Thanks Jeff Singer for the test case.
2015-02-16 19:31:51 +01:00
Markus Holtermann cc22b009e0 Refs #24264 -- Added failing test case for updating a FK when changing a PK
When the primary key column is altered, foreign keys of referencing
models must be aware of a possible data type change as well and thus
need to be re-rendered.

Thanks Tim Graham for the report.
2015-02-16 19:31:51 +01:00
Claude Paroz 58d0dd9260 Refs #24225 -- Added failing test case for removing a previously added field in migrations
When a related field is deleted, the related model must be updated. As
unchanged models are shared in migration states, the related model must
be re-rendered so that the change applies to a new copy of the related
model.

Thanks Henrik Heimbuerger for the report.
2015-02-16 19:31:51 +01:00
Marten Kenbeek f668bac9d2 Fixed #24345 -- Isolated sitemaps_tests from contenttypes_tests; refs #11505 2015-02-16 08:42:43 -05: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
Tim Graham e0b3926026 Isolated auth_tests from contenttypes_tests; refs #11505. 2015-02-14 22:04:48 -05:00
Michael Angeletti 49647bec6e Added missing return value to DurationField.prepare_value(); refs #24339. 2015-02-14 18:38:50 -05: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
Markus Holtermann b4e1090ab2 Removed explicit pointers to migration modules for contrib apps in runtest
Thanks Tim Graham for the patch
2015-02-13 14:29:45 +01:00
Markus Holtermann b06935a486 Refs #22962 -- Made test case use non-conflicting table names 2015-02-13 14:01:54 +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 bd4afef984 Refs #14030 -- Added tests for Value aggregates 2015-02-13 10:06:46 +11: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 d7509c5246 Added a test for UUIDField serialization; refs #24320. 2015-02-12 09:54:42 -05:00
Tim Graham e4999bf671 Added missing import from last commit. 2015-02-12 08:18:10 -05:00
Tim Graham 27eeb64a96 Fixed #17716 -- Prevented include('...', app_name='...') without a namespace. 2015-02-12 08:07:58 -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 7cf3a5786b Updated docs and runtests.py for removal of tests from contrib. 2015-02-11 10:29:54 -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
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
Tim Graham c970018f41 Removed Django 1.7 MIDDLEWARE_CLASSES upgrade check. 2015-02-09 19:16:07 -05:00
Simon Charette 5b75b01939 Refactored an admin_view test case.
Used setUpTestData, client login/logout and manager's count() method.

Thanks to Tim for the review.
2015-02-09 15:08:05 -05:00
Simon Charette 8a590c4b7b Moved a custom admin template test to a more appropriate case.
Thanks to Tim for the review.
2015-02-09 15:07:49 -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
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