Commit Graph

6733 Commits

Author SHA1 Message Date
Simon Charette b44ed404c7 Fixed #24654 -- Based ordering circular references detection on columns.
Thanks to Elmar Bucher for the report and Tim for the review.
2015-04-20 15:49:58 -04:00
Jon Dufresne b5e0eede40 Fixed #22394 -- Refactored built-in datetime lookups to transforms. 2015-04-20 15:11:11 -04:00
Marten Kenbeek 039d7881b4 Refs #24397 -- Sped up model reloading in ProjectState.
Created bulk_update() context manager on StateApps. Sped up unregistering
models in reload_models() by using this context mananger.
2015-04-20 14:42:23 -04:00
Preston Timmons fb267a1d85 Updated template tests to create their own engine.
This continues work to treat Django templates as a library.
2015-04-20 09:11:37 -05:00
Yoong Kang Lim 36eab95e7f Fixed #24667 --- Repaired model_fields cardinality test 2015-04-20 09:40:01 -04:00
Claude Paroz f54c0ec06e Fixed #24658 -- Added missing Meta attribute in schema tests
Without that, the Note model would be initially created and then
the tests using that model failed when run in isolation.
2015-04-19 00:05:58 +02:00
Shai Berger d5a0accaa0 Fixed #24595 Oracle test failure
The only problem for Oracle was the test, which tested nullity on
text/char fields -- but Oracle interprets_empty_strings_as_null.
2015-04-18 18:52:30 +03:00
Claude Paroz 36e90d1f45 Stopped special-casing postgres-specific tests
Refs #23879.
2015-04-18 15:17:49 +02:00
Claude Paroz 6b6d13bf6e Stopped conditional discovery of gis_tests apps
Refs #23879.
2015-04-18 15:17:49 +02:00
Anoop Thomas Mathew 2400329508 Fixed #24349 -- Limited domain name labels to 63 characters in EmailValidator 2015-04-17 18:08:33 -04:00
Claude Paroz 02260ea3f6 Fixed #24595 -- Prevented loss of null info in MySQL field alteration
Thanks Simon Percivall for the report, and Simon Charette and Tim
Graham for the reviews.
2015-04-17 10:25:15 +02:00
Tim Graham ed336a1a5d Fixed gis_tests when run without GIS dependencies. 2015-04-16 19:59:53 -04:00
Tim Graham 33b1635a90 Fixed fixtures tests failure on Python 2 with non-ASCII path. 2015-04-16 13:44:07 -04:00
Yitzhak Clark 188a241880 Fixed #21652 -- Added notification when processing objects in loaddata
Added a running count of the objects processed by loaddata when
verbosity >= 3.
2015-04-16 09:42:18 -04:00
Anssi Kääriäinen 355c5edd93 Fixed #24605 -- Fixed incorrect reference to alias in subquery.
Thanks to charettes and priidukull for investigating the issue, and to
kurevin for the report.
2015-04-16 09:22:00 -04:00
Anssi Kääriäinen fb5c7748da Fixed #24615 -- ordering by expression not part of SELECT
Fixed queries where an expression was used in order_by() but the
expression wasn't in the query's select clause (for example the
expression could be masked by .values() call)

Thanks to Trac alias MattBlack85 for the report.
2015-04-16 09:40:47 +02:00
Riccardo Magliocchetti a429a502ea Updated tests to stop leaking models in shared AdminSite.
This would break upcoming changes and AdminSite assumptions about
having an app_config for each application that has registered
models.
2015-04-15 09:45:26 -04:00
Jon Dufresne 97bb48d9ba Fixed model_fields tests to use django TestCase. 2015-04-15 08:19:25 -04:00
Edward Henderson 910638fc4e Refs #24385 -- Added tests for distinct sum issue fixed in c7fd9b242d 2015-04-14 18:56:50 -04:00
Eric Rouleau d72e0178e9 Fixed #24593 -- Fixed number formatting of readonly IntegerFields in the admin. 2015-04-14 17:49:08 -04:00
Alex Wilson 99d40c6f65 Fixed #24277 -- Added exception when dict used in QuerySet filtering 2015-04-14 13:28:53 -04:00
Eric Rouleau b333d10618 Added tests with number fields for admin.utils.display_for_field(). 2015-04-14 10:57:39 -04:00
Tommy Beadle 6bfd864ff2 Fixed #24603 -- Allowed Context.update() to be used as a context manager. 2015-04-14 08:01:16 -04:00
Craig Oldford 75bc5bc634 Fixed #12199 -- Added the ability to use "as" with the firstof template tag. 2015-04-14 07:19:47 -04:00
Markus Holtermann 3caf7efb44 Refs #24625 -- Filtered docutils warnings output in tests
Instead of setting ``warning_stream`` in the docutils config overrides
to ``False`` I opted for filtering the stderr in the tests to keep the
error output showing up in server logs.

Thanks Tim Graham for the report and review
2015-04-14 10:48:16 +02:00
Jay Wineinger 923da0274a Fixed #24611 -- Fixed update() crash with related UUID pk object. 2015-04-13 12:18:24 -04:00
Markus Holtermann 09595b4fc6 Fixed #24625 -- Prevented arbitrary file inclusion in admindocs
Thanks Tim Graham for the review.
2015-04-11 20:36:10 +02:00
Claude Paroz 4e7ed8d0d3 Fixed #24624 -- Replaced obsoleted rel.opts in admindocs view
Thanks Scott Sanders for the report, and Markus Holtermann and
Tim Graham for the reviews. Refs #24381.
2015-04-11 15:29:02 +02:00
Christopher Luc a7bc00e17b Fixed #24514 -- Made migration writer omit models import if it's unused. 2015-04-10 07:04:26 -04:00
Adam Chainz 5564d0f2ee Fixed #24560 -- Added a --dry-run mode to the createcachetable command. 2015-04-09 12:15:50 -04:00
Richard Eames 727e40c879 Fixed #19820 -- Added more helpful error messages to Python deserializer. 2015-04-09 10:56:33 -04:00
Tim Graham a10b4c010a Fixed #24578 -- Fixed crash with QuerySet.update() on FK to O2O fields.
Thanks Anssi Kääriäinen for review.
2015-04-09 06:50:21 -04:00
Curtis Maloney 88d7fcebde Use mock.patch in migrations tests
Currently some of the migrations tests rely on the fact 'input' is aliased
because of six, instead of using mock.patch.  Replace this code with proper
use of mock.patch.

Also, replace one case of excessively specific python version check with
testing six.PY3
2015-04-09 11:16:12 +10:00
steve 2fc19b9238 Fixed #24544 -- Fixed get_image_dimensions() on image buffers that Pillow fails to parse.
Thanks Steve Kossouho for the report and original patch.
2015-04-07 19:51:19 -04:00
Patryk Zawadzki 0385dad073 Fixed #24513 -- Made sure a model is only rendered once during reloads
This also prevents state modifications from corrupting previous states.
Previously, when a model defining a relation was unregistered first,
clearing the cache would cause its related models' _meta to be cleared
and would result in the old models losing track of their relations.
2015-04-07 14:49:47 +02:00
Jon Dufresne 2cf58e80d1 Fixed #24584 -- Fixed microsecond handling with older MySQLdb 2015-04-06 22:43:51 +02:00
Marten Kenbeek e8e4f978dd Fixed #24278 -- Fixed serialization of migration operations.
Fixed MigrationWriter.serialize() to correctly handle migration
operations by utilizing OperationWriter.

Thanks Piotr Maliński for the report.
2015-04-05 20:26:21 +02:00
Marten Kenbeek d597174bd4 Refs #24278 -- Allowed multi-line serializations in OperationWriter.
Changed OperationWriter to support multi-line serialized values with
correct indentation.
2015-04-05 20:19:24 +02:00
Claude Paroz 7a0d9b5cda Fixed #24569 -- Made some translation functions accept None value
get_language() can return None when translations are deactivated.
Thanks Nicola Peduzzi for the reporti and Tim Graham for the review.
2015-04-04 10:54:16 +02:00
Claude Paroz 426b63ba04 Fixed #24571 -- Restored testserver positional arguments parsing
Thanks Domas Lapinskas for the report and Tim Graham for the
review.
2015-04-04 10:46:29 +02:00
Simon Charette 5bc3123479 Fixed #24558 -- Made dumpdata mapping ordering deterministic.
Thanks to gfairchild for the report and Claude for the review.
2015-04-02 15:21:43 -04:00
Baptiste Mispelon 30a3c2f74c Fixed #24566 -- Added support for serializing timedelta
Thanks to knbk for the report.
2015-04-02 17:21:20 +02:00
Tim Graham 0f941f57ba Fixed mistakes in tests unveiled by version bump to 1.8.1.
Forwardport of e7366ab1f9 from stable/1.8.x
2015-04-02 08:14:08 -04:00
Claude Paroz 2112b7d789 Adapted form regression test to new translations 2015-04-01 19:51:50 +02:00
Tim Graham a184a99123 Refs #24538 -- Simplified a test per Aymeric's feedback. 2015-04-01 13:08:43 -04:00
Preston Timmons 0808ccce38 Fixed #23441, #24555 -- Improved the behavior of InclusionNode.
This change:

* Makes the InclusionNode cache-safe by removing render-time side effects
  to its nodelist.
* Ensures the render_context stack is properly scoped and reset by updating
  the render call to use Template.render rather than Nodelist.render.
2015-04-01 13:02:19 -04:00
Tim Heap 4ea1909d3c Fixed #24538 -- Allowed self in Jinja context
Rendering a Jinja template with self in the context threw an error.
While self is a reserved variable in Jinja, including self in the
context is not an error, so Django should respect that.
2015-04-01 12:26:57 -04:00
Tim Graham 4e59156c10 Fixed sessions test on Python 3.5; refs #23763.
SimpleCookie.__repr__() changed in
https://hg.python.org/cpython/rev/88e1151e8e02
2015-03-31 08:38:43 -04:00
Tim Graham 845817b039 Fixed #24466 -- Added JavaScript escaping in a couple places in the admin.
Thanks Aymeric Augustin and Florian Apolloner for work on the patch.
2015-03-30 19:07:17 -04:00
Tim Graham b86abbceb9 Fixed #24115 -- Allowed bcrypt hashers to upgrade passwords on rounds change.
Thanks Florian Apolloner for the review.
2015-03-30 18:52:59 -04:00
Andriy Sokolovskiy e4cf8c8420 Fixed #24301 -- Added PostgreSQL-specific aggregate functions 2015-03-30 10:44:37 -04:00
Markus Holtermann c5cc332bf2 Fixed #24550 -- Added migration operation description to sqlmigrate output
Thanks Tim Graham for the review.
2015-03-30 16:31:20 +02:00
Simon Charette dc27f3ee0c Fixed #19259 -- Added group by selected primary keys support. 2015-03-29 22:03:30 -04:00
Marten Kenbeek 75430be86f Refs #24366 -- Fixed recursion depth error in migration graph
Made MigrationGraph forwards_plan() and backwards_plan() fall back to an
iterative approach in case the recursive approach exceeds the recursion
depth limit.
2015-03-29 16:08:07 +02:00
Marten Kenbeek bc83add04c Refs #24366 -- Renamed arguments in MigrationGraph, renamed tests 2015-03-29 16:07:58 +02:00
Markus Holtermann c7ec3c07e7 Fixed #24537 -- Ignored field order in RenameModel detection
Thanks to David Sanders for the report and test and Simon Charette for
the review.
2015-03-28 20:45:15 +01:00
Tim Graham ba1665ed75 Fixed skipping of gis_tests when dependencies not installed. 2015-03-28 09:39:09 -04:00
Claude Paroz c2bfd76ec3 Refs #15779 -- Fixed UserChangeForm regression introduced by 1791a7e75
Thanks Tim Graham for reporting the regression.
2015-03-28 09:24:01 +01:00
Moritz Sichert 1f2abf784a Fixed #24469 -- Refined escaping of Django's form elements in non-Django templates. 2015-03-27 19:46:20 -04:00
Caroline Simpson dc5b01ad05 Fixed #18773 -- Added logging for template variable resolving
Added a django.template logger without a default handler. Added
logging if there is an exception while resolving variables in a
template.
2015-03-27 19:19:48 -04:00
Marco Fucci 4ee08958f1 Fixed #24505 -- Fixed clash with hidden m2m fields.
Added support for multiple m2m fields with the same 'to' model
and with related_name set to '+'.
2015-03-26 19:00:37 -04:00
Bas Peschier 14f28f8233 Rephrased docstrings to assertions and added querystring test. 2015-03-26 09:27:37 -04:00
Bas Peschier 9128762f16 Fixed #19910 -- Added slash to i18n redirect if APPEND_SLASH is set.
This introduces a force_append_slash argument for request.get_full_path()
which is used by RedirectFallbackMiddleware and CommonMiddleware when
handling redirects for settings.APPEND_SLASH.
2015-03-26 09:26:55 -04:00
Bertrand Bordage 3e64f3d0fc Fixed #24531 -- Improved CommaSeparatedIntegerField validation.
`','`, `'1,,1'`, `',1'` etc. are no longer considered as valid
comma-separated integer lists.
2015-03-25 18:49:59 -04:00
Andrei Kulakov e2bfcab065 Fixed #24394 -- Allowed running tests with empty default dictionary. 2015-03-25 17:56:59 -04:00
Alex Hill 720ff740e7 Fixed #24215 -- Refactored lazy model operations
This adds a new method, Apps.lazy_model_operation(), and a helper function,
lazy_related_operation(), which together supersede add_lazy_relation() and
make lazy model operations the responsibility of the App registry. This
system no longer uses the class_prepared signal.
2015-03-25 16:48:17 -04:00
Raúl Cumplido cda74c7fc9 Fixed #24441 -- Changed get_image_dimensions() return value for broken images 2015-03-25 12:39:29 -04:00
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