Commit Graph

5065 Commits

Author SHA1 Message Date
Florian Hahn 5240b83462 Fixed #17027 -- Added support for the power operator in F expressions.
Thanks dan at dlo.me for the initial patch.

- Added __pow__ and __rpow__ to ExpressionNode
- Added oracle and mysql specific power expressions
- Added used-defined power function for sqlite
2013-10-22 10:29:57 -04:00
Tim Graham 1597503a01 Fixed E221 pep8 warnings. 2013-10-22 09:51:39 -04:00
Bouke Haarsma 0d0f4f020a Fixed #5789 -- Changed LocaleMiddleware session variable to '_language'.
The old 'django_language' variable will still be read from in order
to migrate users. The backwards-compatability shim will be removed in
Django 1.8.

Thanks to jdunck for the report and stugots for the initial patch.
2013-10-22 09:24:42 -04:00
Tim Graham 8e2029f8dd Removed import * in tests.
Thanks to flake8 path/to/file.py | awk -F ' ' '{ print $5 }' | sort | uniq
2013-10-22 08:32:01 -04:00
Ramiro Morales b5f52647fe Decode from UTF-8 explicitly when reading a text file in makemessages.
This shows itself with Python 3 under Windows where UTF-8 usually isn't
the default file I/O encoding and caused one failure and three errors
in our test suite under that platform setup.
2013-10-22 06:09:21 -03:00
Claude Paroz a098bee1b9 Fixed #19724 -- Output note when showing only core management commands
When listing available management commands, only core commands are
listed if settings have any error. This commit adds a note in this
case so errors are not totally silently skipped.
Thanks Peter Davis for the report.
2013-10-21 21:26:48 +02:00
Loic Bistuer e565e1332d Fixed #21275 -- Fixed a serializer error when generating migrations for contrib.auth.
The migration serializer now looks for a deconstruct method on any object.
2013-10-21 14:54:52 -04:00
Bouke Haarsma 3565efaa45 Removed some direct settings manipulations in tests; refs #21230. 2013-10-21 11:31:05 -04:00
Tim Graham 499cd912ca Fixed E227 pep8 warnings 2013-10-21 08:52:21 -04:00
Alasdair Nicol b289fcf1bf Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
Ramiro Morales a3690168cb Fixed an I18N test class tearDown method. 2013-10-21 01:18:44 -03:00
Loic Bistuer 8d6953d55c Added support for serializing class methods. - Refs #21290.
The new handling allows us to do away with the whitelisting that was
required to support date and datetime objects.
2013-10-19 12:10:18 -04:00
Loic Bistuer 584110417f Fixed #21283 -- Added support for migrations if models is a package.
Thanks Markus Holtermann for the report.
2013-10-19 09:48:57 -04:00
Tim Graham 96d1d4e292 Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Alasdair Nicol bab9123daa Fixed #21268 -- Fixed E303 pep8 warnings 2013-10-18 01:46:24 +01:00
Alasdair Nicol 65d1d65d52 Fixed #21267 -- Fixed E502 pep8 warnings 2013-10-18 01:28:32 +01:00
Alasdair Nicol dfb4cb9970 Fixed #21285 -- Fixed E121,E122 pep8 warnings 2013-10-17 20:20:11 -04:00
Claude Paroz 3514bcb251 Fixed #21284 -- Prevented KeyError swallowing in fetch_command
Thanks wildfire for the report.
2013-10-17 18:57:44 +02:00
Claude Paroz a14f087233 Fixed #21282 -- Made HttpResponse.serialize_headers accept latin-1
Thanks Raphaël Barrois for the report and the initial patch and
Aymeric Augustin for the review.
2013-10-17 18:14:35 +02:00
Loic Bistuer 5008706345 Added test for a921f06 - refs #21280.
This commit also lays the groundwork for future tests for the
makemigrations command.
2013-10-17 12:08:17 -04:00
Bouke Haarsma 2fb5a51fa3 Fixed #18659 -- Deprecated request.REQUEST and MergeDict
Thanks Aymeric Augustin for the suggestion.
2013-10-17 09:42:28 -04:00
Alasdair Nicol eb214452c3 Fixed #21270 -- Fixed E701 pep8 warnings 2013-10-17 12:12:40 +01:00
Claude Paroz 2992f42861 Fixed #19657 -- Made sql commands honor allow_migrate
Thanks Manel Clos for the report and the initial patch, and
Marc Tamlyn and Tim Graham for the review.
2013-10-16 18:02:32 +02:00
Bouke Haarsma 3918eeb9fd Fixed #7551 -- Made GFK allow None init argument.
Thanks SamBull for the report.
2013-10-16 07:03:46 -04:00
Andrew Godwin 42f8666f6a Improve migration optimizer to be able to optimize through other ops 2013-10-16 11:09:33 +01:00
Alex Gaynor 694d7da6c5 Merge pull request #1744 from unaizalakain/ticket_7261
Fixed #7261 -- support for __html__ for library interoperability
2013-10-15 14:43:35 -07:00
Loic Bistuer 776b6470c1 Fixed DeprecationWarning caused by assertEquals. 2013-10-16 02:28:04 +07:00
Marc Tamlyn 349c12d3f5 Fixed #16855 -- select_related() chains as expected.
select_related('foo').select_related('bar') is now equivalent to
select_related('foo', 'bar').

Also reworded docs to recommend select_related(*fields) over select_related()
2013-10-15 15:59:36 +01:00
Claude Paroz 949076eb11 Fixed #21263 -- Fixed issue with override_settings in inherited classes
When both parent and child classes are decorated with override_settings,
child class settings should take precedence.
Thanks Sephi for the report and Marc Tamlyn for the review.
2013-10-15 15:38:27 +02:00
Marc Tamlyn ce823d3710 Merge pull request #1382 from loic/ticket19617
Fixed #19617 -- Refactored form metaclasses to support more inheritance scenarios.
2013-10-15 04:22:34 -07:00
Unai Zalakain af64429b99 Fixed #7261 -- support for __html__ for library interoperability
The idea is that if an object implements __html__ which returns a string this is
used as HTML representation (eg: on escaping). If the object is a str or unicode
subclass and returns itself the object is a safe string type.

This is an updated patch based on jbalogh and ivank patches.
2013-10-15 00:42:42 +02:00
Larry O'Neill 83b9bfea44 Fixed #21266 -- Fixed E201,E202 pep8 warnings. 2013-10-14 18:12:00 -04:00
Claude Paroz 42a67ec1cd Fixed #21269 -- Don't crash when CommandError contains non-ascii
Thanks kontakt@eikefoken.de for the report.
2013-10-14 21:21:07 +02:00
Ramiro Morales 8ab5f1fe47 Close file after tests added in 945e033a69.
Avoids failures on Windows. Refs #8918.
2013-10-14 15:34:43 -03:00
Loic Bistuer b16dd1fe01 Fixed #8620 -- Updated the Form metaclass to support excluding fields by shadowing them. 2013-10-14 22:42:33 +07:00
Loic Bistuer ac5ec7b8bc Fixed #19617 -- Refactored Form metaclasses to support more inheritance scenarios.
Thanks apollo13, funkybob and mjtamlyn for the reviews.
2013-10-14 21:59:30 +07:00
Claude Paroz 1e8eadc94e Fixed #15888 -- Made tablename argument of createcachetable optional
Thanks Aymeric Augustin for the report and the documentation and
Tim Graham for the review.
2013-10-14 13:24:40 +02:00
Aymeric Augustin 589dc49e12 Fixed #21198 -- Prevented invalid use of @python_2_unicode_compatible.
Thanks jpic for the report and chmodas for working on a patch.

Reverts 2ea80b94. Refs #19362.
2013-10-13 18:14:04 +02:00
Aymeric Augustin 570d9c2678 Fixed #19560 -- Identified field in warning for naive datetime.
Thanks gcc for the report and vajrasky for the patch.
2013-10-13 11:54:11 +02:00
Claude Paroz 00a73c1c69 Fixed #21173 -- Stopped fixing format for date-based widgets at init time
Thanks Marc Tamlyn for the review.
2013-10-12 18:31:19 +02:00
Tim Graham ad17d6a85f Fixed errors in 848101bf17 2013-10-11 17:58:07 -04:00
Sascha Peilicke 848101bf17 Added tests for URLValidator schemes. 2013-10-11 13:41:38 -04:00
Tai Lee e527c0b6d8 Fixed #13252 -- Added ability to serialize with natural primary keys.
Added ``--natural-foreign`` and ``--natural-primary`` options and
deprecated the ``--natural`` option to the ``dumpdata`` management
command.

Added ``use_natural_foreign_keys`` and ``use_natural_primary_keys``
arguments and deprecated the ``use_natural_keys`` argument to
``django.core.serializers.Serializer.serialize()``.

Thanks SmileyChris for the suggestion.
2013-10-11 12:52:57 -04:00
Tim Graham 945e033a69 Fixed #8918 -- Made FileField.upload_to optional.
Thanks leahculver for the suggestion and dc and vajrasky for work
on the patch.
2013-10-11 08:07:25 -04:00
Tim Graham b67ab75e82 Fixed assorted flake8 errors. 2013-10-11 07:25:14 -04:00
Tim Graham 1dae4ac177 Whitespace cleanup.
* Removed trailing whitespace.
* Added newline to EOF if missing.
* Removed blank lines at EOF.
* Removed some stray tabs.
2013-10-10 16:49:20 -04:00
Tim Graham ca874b2fe6 Fixed an undefined variable and clarified the purpose of a test.
refs #4459.
2013-10-10 13:01:12 -04:00
Tim Graham adedc31072 Fixed "redefinition of unused 'foo' from line X" pyflakes warnings. 2013-10-10 11:09:42 -04:00
Tim Graham cec11a3336 Used "is" for comparisons with None. 2013-10-10 09:35:56 -04:00
Tim Graham ff9e8eccf8 Removed unnecessary semicolons. 2013-10-10 08:50:32 -04:00
Russell Keith-Magee a971d19bab Fixed #21243 -- Corrected exception message in multiple database tests.
Thanks to vajrasky for the report and patch.
2013-10-09 09:06:23 +08:00
Jaap Roes 40b95a24ae Fixed #20568 -- truncatewords_html no longer splits words containing HTML entities.
Thanks yann0 at hotmail.com for the report.
2013-10-08 08:24:58 -04:00
Tim Graham 58d555caf5 Fixed #16822 -- Added RawPostDataException
Thanks jaylett for the patch.
2013-10-08 08:05:39 -04:00
Russell Keith-Magee 8ff4303946 Refs #21197 -- Clarified upgrade check message.
Thanks to Carl and Shai for the discussion.
2013-10-08 10:00:39 +08:00
Simon Charette a8df8e34f9 Revert "Fixed #21241 -- Avoid extraneous JOINs in admin changelist search."
This reverts commit 698dd82eee.

The patch introduced a backward incompatible change.
2013-10-07 13:45:52 -04:00
Chris Adams 698dd82eee Fixed #21241 -- Avoid extraneous JOINs in admin changelist search. 2013-10-07 13:10:52 -04:00
Tim Graham 617aceb1b4 Fixed #18263 -- Corrrected handling of hidden fields in tabular admin inlines.
Thanks hvdklauw for the report and patch.
2013-10-07 12:30:02 -04:00
Javed Khan 4dbd95ad65 Fixed #21236 -- Allowed migrations to work with unique_together tuples.
Thanks hjwp for the report.
2013-10-07 09:39:14 -04:00
Anssi Kääriäinen 1df3c49a1a Fixed #21174 -- transaction control in related manager methods 2013-10-05 23:07:52 +03:00
Anssi Kääriäinen 93cc6dcdac Fixed #18414 -- qs.exists() for sliced distinct queries 2013-10-05 21:40:36 +03:00
Anssi Kääriäinen 068b1e045f Simplified a test by using CapturedQueriesContext 2013-10-05 21:16:09 +03:00
Aymeric Augustin 671757b507 Fixed #21161 -- Timezone-related tests on Windows.
Thanks Xelnor for the patch.
2013-10-05 18:50:20 +02:00
Anssi Kääriäinen ecaba36028 Improved Query join promotion logic
There were multiple cases where join promotion was a bit too aggressive.
This resulted in using outer joins where not necessary.

Refs #21150.
2013-10-05 14:52:17 +03:00
Anssi Kääriäinen ed0d720b78 Fixed #21150 -- select_related + annotate join promotion failure
Added tests for a .annotate().select_related() join promotion failure.
This happened to work on master but was currently untested.
2013-10-05 14:52:17 +03:00
Simon Charette 948d209ada Fixed #21217 -- Avoid connecting `(pre|post)_init` signals to abstract senders. 2013-10-04 16:23:06 -04:00
Christopher Medrela dc3d2ac98c Fixed #11277 -- Hid labels of fields with HiddenInput widget in admin forms.
Thanks bartTC for the report.
2013-10-04 14:08:06 -04:00
Tai Lee bcd4c3f27d Fixed #6681 -- Don't break docutils when rendering reStructuredText.
Don't set a global default interpreted role function for reStructuredText.
Instead, use the `default-role` directive to change the default only within
the `parse_rst()` function.

Thanks Malcolm Tredinnick for the report.
2013-10-04 13:27:08 -04:00
Emil Stenström 7a97df190c Fixed #19277 -- Added LocaleMiddleware.response_redirect_class
Thanks ppetrid at yawd.eu for the suggestion.
2013-10-03 16:15:29 -04:00
Simon Charette fa2e1371cd Fixed #21216 -- Allow `OneToOneField` reverse accessor to be hidden. 2013-10-03 13:20:05 -04:00
Anentropic c4db7f075e Fixed #19182 -- Fixed ModelAdmin.lookup_allowed to work with ('fieldname', SimpleListFilter) syntax.
Thanks gauss for the report.
2013-10-03 09:37:49 -04:00
Ramiro Morales 62dfd79f8b Fixed #21165 -- Fix test for syndication feed timestamp field on Windows.
Thanks Michael Manfre for the report, Raphaël Barrois for the patch and
Claude Paroz, Aymeric Augustin for the reviews.

Refs #7936.
2013-10-02 23:29:48 -03:00
Andrew Godwin a80d9ab0fe Initial version of MigrationOptimizer and tests 2013-10-02 17:34:22 +01:00
Kevin Christopher Henry 978e1351a6 Fixed #21122 -- Improved clean up of test temp directory on Windows
- Fixed test that didn't close the files it opened
- Caught and handled exception when temp directory cannot be removed
2013-10-02 09:12:58 -04:00
tschilling 5381317fe3 Fixed #21129 -- Prevented admin filter params modifications from throwing an exception.
Thanks Tuttle for the report.
2013-10-02 08:16:09 -04:00
Ramiro Morales 651bed0918 Made test for issue 19552 compatible with Windows.
Take in account platform path separator. Refs #19552.
2013-10-02 07:29:40 -03:00
Ramiro Morales 0f46ec315e Made skipping of symlink-related makemessages test smarter.
os.symlink() is available starting with Windows Vista but can fail at
runtime.
2013-10-02 07:17:08 -03:00
Ramiro Morales 43959d1057 Fixed tests breakage from last commit. 2013-10-01 21:02:42 -03:00
Ramiro Morales 4b715fc05a Fixed #21209 -- .po file path comments on Windows.
Literals from source files with Django template language syntax don't
have a '.py' suffix anymore.

Also, the '.\' prefix is preserved to respect GNU gettext behavior on
that platform.

Refs #16903.
2013-10-01 20:37:43 -03:00
Ramiro Morales 1d0fc61b1c Fixed #15185 -- Allowed ModelAdmin.list_display_links=None to disable change list links.
Thanks rm_ for the suggestion.
2013-10-01 14:25:54 -04:00
Anssi Kääriäinen 8c27247397 Added default value for a BooleanField in test models
Test models introduced for #10733 didn't contain default value for
a BooleanField(). Check command didn't like that -> check tests failed.
2013-10-01 20:36:06 +03:00
Anssi Kääriäinen bf13c75c0d Fixed #21203 -- resolve_columns fields misalignment
In queries using .defer() together with .select_related() the values
and fields arguments didn't align properly for resolve_columns().
2013-10-01 20:29:23 +03:00
Anssi Kääriäinen 8d4b1629d4 Fixed #10733 -- select_related().only() failure
The bug was reported pre 1.1, and somewhere along the way it has been
fixed. So, this is tests only addition.
2013-10-01 19:29:48 +03:00
Claude Paroz c1c44b2506 Factorized requires_tz_support decorator in test utils
Thanks Aymeric Augustin for the suggestion. Refs #21165.
2013-10-01 13:20:41 +02:00
Loic Bistuer d847ddfe1d Fixed #3871 -- Fixed regression introduced by 04a2a6b.
Added do_not_call_in_templates=True attribute to RelatedManagers
to prevent them from being called.

Thanks jbg@ for the report.
2013-09-30 15:43:44 -04:00
Tim Graham f93896344a Fixed Python 3.2 syntax errors; refs #13724. 2013-09-30 10:28:01 -04:00
Aymeric Augustin 728548e483 Fixed #21134 -- Prevented queries in broken transactions.
Squashed commit of the following:

commit 63ddb271a44df389b2c302e421fc17b7f0529755
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 29 22:51:00 2013 +0200

    Clarified interactions between atomic and exceptions.

commit 2899ec299228217c876ba3aa4024e523a41c8504
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 22 22:45:32 2013 +0200

    Fixed TransactionManagementError in tests.

    Previous commit introduced an additional check to prevent running
    queries in transactions that will be rolled back, which triggered a few
    failures in the tests. In practice using transaction.atomic instead of
    the low-level savepoint APIs was enough to fix the problems.

commit 4a639b059ea80aeb78f7f160a7d4b9f609b9c238
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Sep 24 22:24:17 2013 +0200

    Allowed nesting constraint_checks_disabled inside atomic.

    Since MySQL handles transactions loosely, this isn't a problem.

commit 2a4ab1cb6e83391ff7e25d08479e230ca564bfef
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Sep 21 18:43:12 2013 +0200

    Prevented running queries in transactions that will be rolled back.

    This avoids a counter-intuitive behavior in an edge case on databases
    with non-atomic transaction semantics.

    It prevents using savepoint_rollback() inside an atomic block without
    calling set_rollback(False) first, which is backwards-incompatible in
    tests.

    Refs #21134.

commit 8e3db393853c7ac64a445b66e57f3620a3fde7b0
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Sep 22 22:14:17 2013 +0200

    Replaced manual savepoints by atomic blocks.

    This ensures the rollback flag is handled consistently in internal APIs.
2013-09-30 09:42:27 +02:00
Russell Keith-Magee 9595183d03 Fixed #13724: Corrected routing of write queries involving managers.
Previously, if a database request spanned a related object manager, the
first manager encountered would cause a request to the router, and this
would bind all subsequent queries to the same database returned by the
router. Unfortunately, the first router query would be performed using
a read request to the router, resulting in bad routing information being
used if the subsequent query was actually a write.

This change defers the call to the router until the final query is acutally
made.

It includes a small *BACKWARDS INCOMPATIBILITY* on an edge case - see the
release notes for details.

Thanks to Paul Collins (@paulcollinsiii) for the excellent debugging
work and patch.
2013-09-30 13:05:43 +08:00
Ramiro Morales 12ca312e1b Modified test added in 3afb5916b2 so it doesn't fail on Windows.
Refs #18091.
2013-09-29 22:44:55 -03:00
Simon Charette c4fdd859ec Fixed #15786 -- Added a regression test for o2o excludes using F().
The issue was reported against 1.3.x but has been fixed since.
2013-09-29 16:45:03 -04:00
Michael Manfre b0e06c3662 Fixed #21167 - Improved queries.tests.SubqueryTests
Improve tests to cover slicing scenarios that could be handled in unique
ways by 3rd party database backends.
2013-09-29 17:35:42 +03:00
Christopher Babiak a834bc84d8 Fixed #20931 -- Fixed select widgets nested choice rendering
ChoiceFieldRenderer was not rendering nested choices. Added recursion
to ChoiceFieldRenderer to take nested choices and render them as
<ul>'s.
2013-09-28 17:25:32 -07:00
Anssi Kääriäinen 47e79bfcfb Fixed #21187 -- Import CursorWrapper from django.db.backend.utils
The import was done from util instead of utils leading to
PendingDeprecationWarning.
2013-09-28 14:18:37 +03:00
Erik Romijn 1a63092981 Fixed #20439 -- Started deprecation of IPAddressField 2013-09-28 10:55:32 +02:00
Baptiste Mispelon 8f51ba669a Fixed #21186: Fixed regression when using date fields in the admin's list_filter.
Thanks to onlygoldi2201 for the report and to ramiro and apollo13
for the reviews.
2013-09-28 00:40:43 +02:00
Baptiste Mispelon 3754f4ad41 Fix #21185: Added tests for unescape_entities.
Also fixed a py3 incompatibility.
Thanks to brutasse for the report.
2013-09-27 17:00:42 +02:00
Simon Charette 209de62d22 Fix Python 3.2 compatiblity by removing unicode literals. 2013-09-26 00:03:57 -04:00
Giles Richard Greenway 6c06adad1d Fixed #20364 -- Changed urlize regexes to include quotation marks as punctation.
Thanks to EmilStenstrom for raising this, and to Chris Piwoński for all of the fixes and most of the tests.
2013-09-25 22:17:22 +02:00
Michael Manfre 99c87f1410 Fixed #17671 - Cursors are now context managers. 2013-09-25 21:47:26 +03:00
Loic Bistuer 04a2a6b0f9 Fixed #3871 -- Custom managers when traversing reverse relations. 2013-09-25 21:15:59 +03:00
Anssi Kääriäinen 83554b018e Fixed #21126 -- QuerySet value conversion failure
A .annotate().select_related() query resulted in misaligned rows vs
columns for compiler.resolve_columns() method.

Report & patch by Michael Manfre.
2013-09-25 20:47:57 +03:00
Andrew Godwin f671fb9d11 Remove most errors when running migration tests twice 2013-09-25 16:11:05 +01:00
Andrew Godwin fe9f342d8c Allow callables as the argument to RunPython 2013-09-25 16:10:43 +01:00
Andrew Godwin 3b810c5656 Add RunPython migration operation and tests 2013-09-25 13:58:07 +01:00
Andrew Godwin 05656f2388 Add equality support for Project/ModelState 2013-09-25 13:47:46 +01:00
Michael Manfre 9a041807fc Fixed #18333 - Quoted annotated column names 2013-09-24 10:10:08 -04:00
Andrew Godwin 6ede1db331 Fixed #21151 -- Bad cleanup in schema M2M repoint test 2013-09-24 11:00:00 +01:00
Florian Apolloner 16ceb05b47 Isolated select_for_update tests a bit more.
This change prevents including the multiple_database test models without
duplicating the router code (we probably should do this at one point).

Refs #21148
2013-09-24 10:29:21 +02:00
Simon Charette ab643cd634 Fixed test suite bisection on Python 3.
Thanks to @marfire for spotting this.
2013-09-23 17:05:36 -04:00
Simon Charette 4ec6d281cd Fixed #21001 -- Added a regression test for empty string exclusion on Oracle.
The issue was present in 1.4.x but has been reported to be fixed in master.

Thanks to @timgraham for the patch.
2013-09-23 14:18:03 -04:00
Helen ST 41167645b1 Fixed #14028 - Added validation for clashing db_columns.
Thanks akaariai for the suggestion.
2013-09-23 11:51:58 -04:00
Florian Apolloner 4fcc1e4ad8 Stopped a test from executing queries at the module level.
Currently module level queries are executed against the real database
(specified in NAME) instead of the test database; since it is to late
to fix this for 1.6, we at least ensures stable builds. Refs #21443.
2013-09-22 23:02:35 +02:00
Aymeric Augustin e6c0020d19 Translated a test to English for consistency.
Also fixed a typo.
2013-09-22 22:48:22 +02:00
Florian Apolloner 2ca00faa91 Fixed "Address already in use" from liveserver.
Our WSGIServer rewrapped the socket errors from server_bind into
WSGIServerExceptions, which is used later on to provide nicer
error messages in runserver and used by the liveserver to see if
the port is already in use. But wrapping server_bind isn't enough since
it only binds to the socket, socket.listen (which is called from
server_activate) could also raise "Address already in use".

Instead of overriding server_activate too I chose to just catch socket
errors, which seems to make more sense anyways and should be more robust
against changes in wsgiref.
2013-09-22 22:02:59 +02:00
Aymeric Augustin a5b062576b Removed a few trailing backslashes.
We have always been at war with trailing backslashes.
2013-09-22 14:04:10 +02:00
Aymeric Augustin ee0ef1b094 Partial revert of 165f44aa.
That commit didn't always improve readability.

See discussion on django-developers for details.
2013-09-22 14:04:10 +02:00
Aymeric Augustin 5444a9c683 Fixed #21074 -- Added tests for localized datetime fields.
Fields must render values in the current time zone.

This commit only contains tests because this ticket was just a symptom of
a regression from #18777 that was fixed separately.
2013-09-21 23:10:14 +02:00
Aymeric Augustin 68b10fa177 Ensured that explicit time zones are rejected by forms.
Refs #19371.
2013-09-21 21:09:25 +02:00
tschilling 0d1ba84d13 Fixed #20702 -- Deprecated get_formsets in favor of get_formsets_with_inlines.
Thanks stanislas.guerra at gmail.com for the report.
2013-09-20 07:47:24 -04:00
yokomizor df27803a55 Fixed #9532 -- Added min_num and validate_min on formsets.
Thanks gsf for the suggestion.
2013-09-19 13:11:49 -04:00
Curtis Maloney 4e9f800742 Fixed #21125 -- Removed support for cache URI syntax 2013-09-19 10:01:39 -04:00
Tim Graham 7fec5a2240 Fixed #7557 -- Added type checking to Variable initialization.
Thanks tobias for the suggestion and boblefrag and saz for work on the
patch.
2013-09-19 09:27:19 -04:00
Tim Graham e23de9e350 Fixed typo in exception message; refs #19414
Thanks Alexey Boriskin for the report.
2013-09-19 06:24:12 -04:00
Brian Holdefehr 98514849dc Fixed #19414 -- Added admin registration decorator
Thanks stavros for the suggestion.
2013-09-18 11:44:10 -04:00
Tim Graham 2daada800f Fixed #21098 -- Applied sensitive_post_parameters to MultiValueDict
Thanks simonpercivall for the report and bmispelon for the review.
2013-09-18 09:48:36 -04:00
Tim Graham 4f40b97d97 Fixed #21118 -- Isolated a test that uses the database.
Thanks rmboggs for the report.
2013-09-18 09:42:47 -04:00
Berker Peksag 2f0566fa61 Fixed #4278 -- Added a dirs parameter to a few functions to override TEMPLATE_DIRS.
* django.template.loader.get_template()
* django.template.loader.select_template()
* django.shortcuts.render()
* django.shortcuts.render_to_response()

Thanks amcnabb for the suggestion.
2013-09-18 07:37:08 -04:00
Tim Graham 893198509e Fixed #15625 -- Made message in MultiValueDictKeyError less verbose.
Thanks margieroginski for the suggestion.
2013-09-18 06:44:38 -04:00
Anssi Kääriäinen 50633e7353 Fixed #12568 -- no error when accessing custom field's descriptor
The SubfieldBase's descriptor caused an AttributeError when accessed
from the class. Introspection didn't like that.

Patch by Trac alias supervacuo.
2013-09-18 10:03:52 +03:00
Markus Holtermann a772ea8117 Fixed #21115 -- Fixed NameError in migrate --list command 2013-09-17 12:53:59 -04:00
Markus Holtermann 5a424c2393 Fixed #21114 -- Migrations must not have a dependency to themselves. 2013-09-17 11:47:19 -04:00
Tim Graham 1234225068 Fixed test failures introduced in previous commit. 2013-09-16 13:12:50 -04:00
Tim Graham 18ffdb1772 Fixed #17627 -- Renamed util.py files to utils.py
Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
2013-09-16 12:52:05 -04:00
Florian Apolloner 351a061497 Fixed a timing edge case in the RelatedFieldWidgetSeleniumFirefoxTests.
By settings an implicit wait timeout for the find_* methods we can wait
till the javascript code add the new option to the DOM.

See http://ci.djangoproject.com/job/Django/database=mysql_gis,python=python3.3/3174/testReport/junit/admin_widgets.tests/RelatedFieldWidgetSeleniumFirefoxTests/test_foreign_key_using_to_field/

Stacktrace:
Traceback (most recent call last):
  File "/var/lib/jenkins/jobs/Django/workspace/database/mysql_gis/python/python3.3/tests/admin_widgets/tests.py", line 1060, in test_foreign_key_using_to_field
      self.assertEqual(username_value, new_option.get_attribute('value'))
      AssertionError: 'newuser' != 'testser'
      - newuser
      + testser
2013-09-15 01:11:07 +02:00
Tim Graham 886bb9d878 Revert "Fixed #12288 -- Validated that app names in INSTALLED_APPS are unique"
This reverts commit c1ec08998d.

There are backwards compatability concerns with this.
2013-09-14 07:19:32 -04:00
Anssi Kääriäinen 74b91b3888 Added tests for double-pickling a QuerySet
Refs #21102.
2013-09-14 10:33:15 +03:00
Michael Manfre c89d80e2cc Fixed #21097 - Added DatabaseFeature.can_introspect_autofield 2013-09-14 09:48:59 +03:00
Juan Catalano 6feb75129f Fixed #21060 -- Refactored admin's autodiscover method to make it reusable.
We want to be able to use it for instance for discovering `tasks.py` modules
inside the INSTALLED_APPS.

This commit therefore moves the logic to `autodiscover_modules` method in
django.utils.module_loading.
2013-09-13 20:09:41 -04:00
e0ne c1ec08998d Fixed #12288 -- Validated that app names in INSTALLED_APPS are unique 2013-09-13 08:09:21 -04:00
Michael Manfre 018037736f Fixed #21099 - Skip DistinctOnTests unless backend can_distinct_on_fields 2013-09-12 14:32:23 -04:00
Michael Manfre e61cc87129 Fixed #21090 -- Allowed backends to provide dotted field path to inspectdb. 2013-09-11 13:35:26 -04:00
Baptiste Mispelon abb10db06f Fixed #21089 -- Allow TransactionTestcase subclasses to define an empty list of fixtures.
Thanks to lgs for the report and initial patch.
2013-09-11 15:28:04 +02:00
Keryn Knight 170f721367 Fixed #21056 -- AdminSite.app_index no longer blindly accepts any app-labelish input. 2013-09-11 08:48:32 -04:00
Tim Graham 7fe5b656c9 Prevented arbitrary file inclusion with {% ssi %} tag and relative paths.
Thanks Rainer Koirikivi for the report and draft patch.

This is a security fix; disclosure to follow shortly.
2013-09-10 21:02:48 -04:00
Tim Graham 4e96dac450 Fixed #19298 -- Added MultiValueField.__deepcopy__
Thanks nick.phillips at otago.ac.nz for the report.
2013-09-10 13:56:49 -04:00
Florian Apolloner d5d0e03ec8 Fixed test errors from 053de6131a on py3.2. 2013-09-10 19:17:01 +02:00
e0ne 053de6131a Fixed #5749 -- Added field_name as a key in the _html_output dict
Thanks SmileyChris for the suggestion.
2013-09-10 13:00:10 -04:00
Juan Catalano 4840fd9cbc Fixed #20919 -- Extended assertRedirects to be able to avoid fetching redirect's response.
Thanks mjtamlyn for the suggestion.
2013-09-10 12:22:55 -04:00
Aymeric Augustin 79ccd1a101 Fixed test that fails when pytz is installed.
pytz' localize() method is the bane of my life.
2013-09-10 18:07:29 +02:00
Gregor MacGregor b2b763448f Fixed #20841 -- Added messages to NotImplementedErrors
Thanks joseph at vertstudios.com for the suggestion.
2013-09-10 11:09:59 -04:00
Loic Bistuer d59f1993f1 Made MigrationWriter look for a "deconstruct" attribute on functions.
Refs #20978.
2013-09-10 10:12:23 -04:00
Tim Graham 4ba373840a Fixed #16534 -- Improved ability to customize DiscoverRunner
Added DiscoverRunner.test_suite and .test_runner attributes.

Thanks tomchristie for the suggestion and jcd for the patch.
2013-09-10 09:49:39 -04:00
Roberto Aguilar af67ce5e18 Fixed #4574 -- Added CSS classes to the admin calendar widget for better control over styling. 2013-09-10 08:07:17 -05:00
e0ne f2a4452882 Fixed #18403 -- Initialized bad_cookies in SimpleCookie
Thanks Stefano Crosta for the report.
2013-09-10 08:26:54 -04:00
homm 7008ed61c5 Fixed #21033 -- Fixed uploaded filenames not always being truncated to 255 characters 2013-09-10 01:55:16 +02:00
Florian Apolloner df2fd4e09b Removed unneeded imports in tests's __init__.py and unified them. 2013-09-09 23:01:07 +02:00
Aymeric Augustin d9413d33b2 Refactored code and tests that relied on django.utils.tzinfo.
Refs #17262.
2013-09-09 22:32:52 +02:00
Aymeric Augustin ec2778b445 Fixed #17262 -- Refactored tzinfo implementations.
This commit deprecates django.utils.tzinfo in favor of the more recent
django.utils.timezone which was introduced when Django gained support
for time zones.
2013-09-09 22:32:51 +02:00
Kevin Christopher Henry 9d700322b3 Fixed #19885 -- cleaned up the django.test namespace
* override_settings may now be imported from django.test
* removed Approximate from django.test
* updated documentation for things importable from django.test

Thanks akaariai for the suggestion.
2013-09-09 16:03:13 -04:00
Josh Mize a52cc1c088 Fixed #21078 -- Handled additional bad Accept-Language header 2013-09-09 15:19:09 -04:00
Keryn Knight 0d74f9553c Fixed #21063 -- AdminSite app_index should be fail early if the user has no permissions. 2013-09-09 12:51:03 -04:00
Tim Graham 789d8f0748 Fixed syntax error on Python 3.2; refs #20889. 2013-09-09 09:54:08 -04:00
Curtis Maloney 7c6f2ddcd9 Simplify FilterExpression.args_check 2013-09-09 09:03:50 -04:00
Daniel Boeve 6dca603abb Fixed #20889 -- Prevented email.Header from inserting newlines
Passed large maxlinelen to email.Header to prevent newlines from being
inserted into value returned by _convert_to_charset

Thanks mjl at laubach.at for the report.
2013-09-09 08:47:41 -04:00
Tim Graham aeed2cf3b2 Added a test to show that the user.is_staff check in admin base.html is necessary.
refs #21067
2013-09-09 07:59:35 -04:00
Baptiste Mispelon 28a571348b Fix #20745: Don't silence TypeError raised inside templates.
Thanks to robin for the report and claudep for the review.
2013-09-08 22:05:35 +02:00
Alex Gaynor 9d11522599 Removed some more unused local vars 2013-09-08 12:20:01 -07:00
Aymeric Augustin c687bf0620 Further hardening. Refs #18766. 2013-09-08 20:43:04 +02:00
Aymeric Augustin 1a1e14786a Hardened the test introduced in ded11aa6. Refs #18766.
Inputs acceptable to time.mktime are platform-dependent.
2013-09-08 19:40:42 +02:00
Alex Gaynor 96fd5557f9 Removed a ton of unused local vars 2013-09-08 08:05:16 -07:00
Aymeric Augustin ded11aa620 Fixed #18766 -- Pointed to pytz when LocalTimezone fails.
Thanks void for the report.
2013-09-08 02:04:43 -05:00
Pablo Mouzo b11564fd36 Fixed #16869 -- BaseGenericInlineFormSet.save_new should use form's save() method
Thanks mattaustin for the report and Pablo Recio (pyriku) for the patch.
2013-09-07 20:00:38 -04:00
Alex Gaynor c348550d35 Fixed some flake8 warnings 2013-09-07 15:36:00 -07:00
Juan Catalano 04415bf81b Fixed #21013 -- Ensure that ModelAdmin.get_queryset is considered for the admin history view. 2013-09-07 14:53:29 -05:00
Julien Phalip 8ef060e0e6 Fixed a test failure introduced in 55a11683f7. 2013-09-07 12:41:33 -05:00
Julien Phalip 55a11683f7 Fixed #20836 -- Ensure that the ForeignKey's to_field attribute is properly considered by the admin's interface when creating related objects.
Many thanks to Collin Anderson for the report and patch and to Peter Sheats for the test.
2013-09-07 12:14:07 -05:00
Aymeric Augustin 65b6eff322 Fixed #20530 -- Properly decoded non-ASCII query strings on Python 3.
Thanks mitsuhiko for the report.

This commit just adds a test since the problem was fixed in 8aaca651.
2013-09-07 11:47:38 -05:00
Andrew Godwin bacbbb481d RunSQL migration operation and alpha SeparateDatabaseAndState op'n. 2013-09-07 11:03:38 -05:00
Aymeric Augustin f5add4712f Fixed tests introduced in previous commit on Python 2. Refs #20557. 2013-09-07 10:43:44 -05:00
Aymeric Augustin 8aaca651cf Fixed #20557 -- Properly decoded non-ASCII cookies on Python 3.
Thanks mitsuhiko for the report.

Non-ASCII values are supported. Non-ASCII keys still aren't, because the
current parser mangles them. That's another bug.
2013-09-07 10:25:43 -05:00
Alex Gaynor 97a626d898 Fixed this syntax error on py32 2013-09-06 21:56:57 -07:00
Aymeric Augustin a9589dd280 Fixed #21032 -- pip 1.4 can't install pytz. 2013-09-06 22:11:55 -05:00
Eric Boersma ded40142a9 Fixed #20007 -- Configured psycopg2 to return UnicodeArrays
Thanks hogbait for the report.
2013-09-06 20:43:58 -04:00
Russell Keith-Magee 926bc421d9 Merge pull request #1566 from adamsc64/ticket_11857
Fixed #11857 -- Added missing 'closed' property on TemporaryFile class.
2013-09-06 17:38:37 -07:00
Tim Graham b7451b72ed Fixed deprecation warning on Python 3 2013-09-06 20:36:17 -04:00
Loic Bistuer adc0ab3386 Fixed #21037 -- Made MigrationWriter raise a ValueError when serializing lambda functions. 2013-09-06 20:13:01 -04:00
Tim Graham 67863b3bfe Fixed test failure introduced in efd1e6096e (sqlmigrate) 2013-09-06 19:59:25 -04:00
Russell Keith-Magee 4f5faa1916 Merge pull request #1582 from rca/12756-missing-yaml-module-serializer-error-message
Fixed #12756: Improved error message when yaml module is missing.
2013-09-06 16:05:02 -07:00
Roberto Aguilar 01a5359477 Cleanup commit after peer review. 2013-09-06 22:45:31 +00:00
Russell Keith-Magee 9b2dc12b83 Merge pull request #1580 from ianawilson/ticket_16502
Fixed #16502 -- Fixed a TemplateDoesNotExist error that should be an ImproperlyConfigured.

Assistance on the patch from #jambronrose.
2013-09-06 15:31:25 -07:00
Roberto Aguilar 9587d4eea0 Fixed existing tests to handle BadSerializer.
When a BadSerializer instance is stubbed in for the yaml serializer,
make sure tests do not fail.
2013-09-06 22:26:13 +00:00
Roberto Aguilar ca3ac4a3e3 Updated NoYamlSerializerTestCase to run with yaml.
In order to verify the behavior of using the yaml serializer when yaml
is on the system, fake the ImportError when the serializer is being
registered.
2013-09-06 22:26:13 +00:00
Ian Wilson d005130845 fixed test name from an old, overly specific iteration of the test 2013-09-06 17:20:43 -05:00
Aymeric Augustin b4cd8169de Fixed #11811 -- Data-loss bug in queryset.update.
It's now forbidden to call queryset.update(field=instance) when instance
hasn't been saved to the database ie. instance.pk is None.
2013-09-06 17:15:23 -05:00
Russell Keith-Magee 122020fdb9 Merge pull request #1579 from ianawilson/ticket_21058
Fixed #21058 -- Fixed debug view blowing up when no template is provided to the template rendering functions.

Assistance on this commit from @jambonrose.
2013-09-06 15:06:57 -07:00
Ian Wilson e12de0ac04 Removed unnecessary, leftover imports 2013-09-06 22:04:58 +00:00
Adrian Holovaty e844e10b4f Moved a settings usage up the stack in utils/formats.py #unsettings 2013-09-06 17:01:36 -05:00
Ian Wilson b79df0b358 adds fix for SingleObjectTemplateResponseMixin raising a TemplateDoesNotExist when it should have raised an ImproperlyConfigured. fixes 16502. by @ianawilson, @jambonrose 2013-09-06 16:27:34 -05:00
Julien Phalip d5df914fe1 Merge pull request #1578 from rmutter/ticket_20821
Fixed #20821 -- Added tooltips to Admin SelectBox widget
2013-09-06 14:03:58 -07:00
Ian Wilson 9b7f4aab32 adds fix and test for when a template is not specified at all to render(). fixes #21058. by jambonrose and ianawilson 2013-09-06 15:50:18 -05:00
Rudy Mutter c438cc2a36 Fixed #20821 -- Added tooltips to Admin SelectBox widget
The Admin widget, which can be used to filter multiple selects
can sometimes be too narrow and hide information such as
user permissions. This commit adds tooltips to the select
options so that a user can hover over and see the hidden text.
2013-09-06 15:46:38 -05:00
Andrew Godwin efd1e6096e Adding 'sqlmigrate' command and quote_parameter to support it. 2013-09-06 15:28:12 -05:00
Roberto Aguilar d8d61d8260 Added tests for missing pyyaml.
This test makes sure an YAML import errors are communicated to the
caller rather than stating the serializer does not exist.
2013-09-06 20:23:27 +00:00
Dan Johnson df462cf760 Fixed #21043 -- Made resolve() handle reverse_lazy objects.
Thanks Keryn Knight for the report.
2013-09-06 15:46:43 -04:00
Florian Apolloner 85359ec9a4 Merge branch 't20812' 2013-09-06 21:03:46 +02:00
Daniel Langer cc957cb16c Fixed #4287 -- Fixed NaN and +/- Infinity handling in FloatField
NaN, +Inf, and -Inf are no longer valid values for FloatFields.
2013-09-06 14:56:37 -04:00
Christopher Adams b2f5ac1656 Fixed #11857 -- Added missing 'closed' property on TemporaryFile class.
- TemporaryFile now minimally mocks the API of the Python standard
  library class tempfile.NamedTemporaryFile to avoid AttributeError
  exceptions.
- The symbol django.core.files.NamedTemporaryFile is actually assigned
  as a different class on different operating systems.
- The bug only occurred if Django is running on Windows, hence why it
  was hard to diagnose.
2013-09-06 14:32:46 -04:00
Andrew Godwin 05e14e8eaf Migration autodetector now corerctly deals with proxy models 2013-09-06 12:39:46 -05:00
Florian Apolloner 2326dedde8 Fixed #20812 -- Error out if __unicode__/__str__ doesn't return a text type. 2013-09-06 19:24:18 +02:00
Andrew Godwin be983ee403 Also test failure case of ProjectState dependency resolution 2013-09-06 12:18:24 -05:00
Andrew Godwin cdeff3acc2 Project/ModelState now correctly serialize multi-model inheritance 2013-09-06 12:16:03 -05:00
Andrew Godwin 6f7977bb63 Fixed #21029: Test for previously-commited SchemaEditor.__exit__ bug. 2013-09-06 12:16:03 -05:00
Chris Wilson eade315da1 Fixed #10164 -- Made AutoField increase monotonically on SQLite
Thanks malte for the report.
2013-09-06 12:31:17 -04:00
Aymeric Augustin e492ab8e7e Fixed #18719 -- Made force_bytes more consistent with force_text. 2013-09-06 10:28:28 -05:00
Markus Holtermann bd8e1a354c Fixed #20977 -- Fixed writing migrations to disk on Python 3 2013-09-06 09:51:58 -04:00
Preston Timmons 8625c7aab3 Fixed #16096 -- Added origin attribute to template instances.
Thanks jdunck for the suggestion.
2013-09-06 09:14:52 -04:00
Loic Bistuer e1266e50b2 Fixed #21015 -- Fixed MigrationLoader when importlib.import_module returns a file module or an empty directory. 2013-09-06 08:30:19 -04:00
Loic Bistuer 82bbb9fe81 Fixed #21014 -- Fixed gobbled ImportError in MigrationLoader. 2013-09-06 08:30:18 -04:00
Eric Boersma 4d13cc56de Fixed #21035 -- Changed docs to treat the acronym SQL phonetically.
The documentation and comments now all use 'an' to
refer to the word SQL and not 'a'.
2013-09-05 20:14:58 -04:00
Aymeric Augustin 6a6428a36f Took advantage of django.utils.six.moves.urllib.*. 2013-09-05 14:39:23 -05:00
Tim Graham bab039d74c Fixed #21041 -- Removed a duplicate form in tests.
Thanks tuxcanfly.
2013-09-05 05:49:10 -04:00
Loic Bistuer 34d52fd32e Fixed #21010 -- Changed ModelState to only copy _meta.local_fields. 2013-09-04 14:05:59 -04:00
Tim Graham 5649c0af9d Fixed "indentation is not a multiple of four" pep8 issues. 2013-09-03 14:22:21 -04:00
Tim Graham cb98ffe8f4 Fixed a couple unclosed file warnings in tests 2013-09-03 13:37:27 -04:00
Tim Graham 3db66b1d65 Updated syncdb -> migrate in tests. 2013-09-03 11:51:34 -04:00
Tim Graham 86964a7b4f Silenced deprecation warning regarding old SQL location; refs #14300 2013-09-03 11:10:43 -04:00
Tim Graham 2fd03b39ab Removed references to django.utils.unittest which is PendingDeprecation 2013-09-03 09:55:21 -04:00
Tim Graham ec784c486b Silenced deprecation warnings in SortedDict tests; refs [07876cf02b] 2013-09-03 09:48:46 -04:00
Aymeric Augustin 365c3e8b73 Replaced "not PY3" by "PY2", new in six 1.4.0. 2013-09-02 12:11:02 +02:00
Ramiro Morales 41feab3654 Converted tests for admin first form widget auto-focus to Selenium.
Refs #1707 and 1c0c879be3.
2013-09-01 15:07:08 -03:00
Ramiro Morales c01cd4c423 Change test added in 3e34005b1b to be more stable.
It could fail when actual serialization JSON field ordering was
different from the hard-coded one. Refs #13182.
2013-09-01 10:47:35 -03:00
Loic Bistuer ff9e116198 Fixed #21008 -- Made MigrationWriter handle Promise objects. 2013-08-31 20:26:44 -04:00
Ramiro Morales e909ceae9b Made django.test.testcases not depend on staticfiles contrib app.
Do this by introducing a django.contrib.staticfiles.testing.StaticLiveServerCase
unittest TestCase subclass.

Fixes #20739.
2013-08-31 11:02:32 -03:00
Claude Paroz e0643cb676 Properly skipped yaml tests when not installed 2013-08-31 15:23:56 +02:00
Claude Paroz 3e34005b1b Fixed #13182 -- Prevented trailing spaces in indented json output
Thanks Stéphane Raimbault for the report and the initial patch.
2013-08-31 15:18:01 +02:00
Carl Meyer 7211741fc5 Fixed #20999 - Allow overriding formfield class with choices, without subclass restrictions.
Refs #18162. Thanks claudep and mjtamlyn for review.
2013-08-30 17:43:10 -06:00
Claude Paroz b04f8ddbaa Fixed #21005 -- Made schema tests language-independent
Thanks Simon Charette for the review.
2013-08-30 21:28:21 +02:00
Simon Charette 11cd7388f7 Fixed #20989 -- Removed useless explicit list comprehensions. 2013-08-30 10:57:51 -04:00
Curtis Maloney e2f06226ea Improved {% include %} implementation
Merged BaseIncludeNode, ConstantIncludeNode and Include node.

This avoids raising TemplateDoesNotExist at parsing time, allows recursion
when passing a literal template name, and should make TEMPLATE_DEBUG behavior
consistant.

Thanks loic84 for help with the tests.

Fixed #3544, fixed #12064, fixed #16147
2013-08-30 10:36:36 +03:00
Anssi Kääriäinen e973ee6a98 Fixed #20988 -- Added model meta option select_on_save
The option can be used to force pre 1.6 style SELECT on save behaviour.
This is needed in case the database returns zero updated rows even if
there is a matching row in the DB. One such case is PostgreSQL update
trigger that returns NULL.

Reviewed by Tim Graham.

Refs #16649
2013-08-30 09:41:07 +03:00
Simon Charette 36bbe3b7c5 Altered test introduced in f19a3669b8 for the sake of readability. refs #14786 2013-08-29 14:50:55 -04:00
Tim Graham f19a3669b8 Fixed #14786 -- Fixed get_db_prep_lookup calling get_prep_value twice if prepared is False.
Thanks homm for the report and Aramgutang and lrekucki for work on
the patch.
2013-08-29 11:13:34 -04:00
Tim Graham af953c45cc Fixed #16433 -- Fixed a help_text/read only field interaction that caused an admin crash.
Thanks chris at cogdon.org for the report and admackin for the patch.
2013-08-29 09:39:31 -04:00
Tim Graham cf8d6e9108 Fixed #20881 -- Removed contrib.auth.models.AbstractUser.get_absolute_url()
The definition is arbitrary and creates a broken "view on site"
link in the admin if a project doesn't define such a URL.
2013-08-29 06:36:35 -04:00
Curtis Maloney 8d473b2c54 Fixed #7116 -- Optimize RequestContext construction 2013-08-29 10:25:56 +03:00
Curtis Maloney 5cdacbda03 Fixed #17356 -- Allowed {% include %} to render compiled templates
Reviewed by Loic Bistuer and Tim Graham.
2013-08-29 10:22:24 +03:00
Loic Bistuer da800be6dd Fixed #20986 -- Enabled SelectDateWidget to use custom months
Reviewed by Trac alias MarkusH.
2013-08-28 16:39:26 +03:00
Warren Smith dd3a883894 Fixed #20693 -- Add timezone support to built-in time filter.
Modified django.utils.dateformat module, moving __init__() method and
timezone-related format methods from DateFormat class to TimeFormat
base class. Modified timezone-related format methods to return an
empty string when timezone is inappropriate for input value.
2013-08-26 16:15:53 -05:00
Ramiro Morales b785a80d19 Added further fixes, tests for #19949/f33db5a09a.
Thanks Susan Tan. Refs #19949.
2013-08-26 08:47:24 -03:00
Ramiro Morales 51a9a5980a Made coverage ignore files without associated source code.
This only affests reporting not data collection and allows coverage.py
to succesfully finish the generation of e.g. the HTML report.

Cases of code whose execution data is collected during the run phase but
for which no associated source code files can be found at the reporting
phase include tests with egg files and Python module files created at
test execution-time.
2013-08-25 22:29:43 -03:00
Ramiro Morales 72712755c4 Ignore coverage HTML report output dir in tests.
Added it to the list of dirs ignored by tests/runtests.py.
2013-08-25 19:09:03 -03:00
Christopher Medrela 32a962bdbf Fixed #20814 -- Improved model field accessor clash error messages
Thanks shai for the suggestion.
2013-08-24 18:00:23 -04:00
Claude Paroz f4e9804567 Fixed #20961 -- Fixed HttpResponse default empty content
Thanks epandurski at gmail.com for the report.
2013-08-24 18:10:12 +02:00
SusanTan f33db5a09a Fixed 19949 -- Cached template loader now caches TemplateDoesNotExist
Thanks @timgraham and @jdunck for the code reviews and Kronuz for bug
report and initial patch.
2013-08-24 09:19:55 -04:00
Alex Gaynor 8363406dad Removed usage of u"" string prefix, which doesn't work on python3.2 2013-08-23 04:56:37 -07:00
Andrew Godwin 5569b0b92f Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/backends/oracle/base.py
	django/db/backends/postgresql_psycopg2/base.py
	django/db/models/signals.py
	tests/queries/tests.py
2013-08-23 12:36:53 +01:00
Andrew Godwin ac45f9c9c5 Fix some small errors in the tests 2013-08-23 12:07:43 +01:00
Tim Graham b0ce6fe656 Fixed #20922 -- Allowed customizing the serializer used by contrib.sessions
Added settings.SESSION_SERIALIZER which is the import path of a serializer
to use for sessions.

Thanks apollo13, carljm, shaib, akaariai, charettes, and dstufft for reviews.
2013-08-22 13:58:26 -04:00
Lukasz Balcerzak 9d1987d767 Fixed #19303 -- Fixed ModelAdmin.formfield_overrides on fields with choices 2013-08-22 11:50:52 -04:00
Rainer Koirikivi 65cf82bd08 Fixed #20934 -- Avoided NoReverseMatch in ModelAdmin.changelist_view
The view tried to display links to a ModelAdmin's change_view, which
resulted in NoReverseMatches if get_urls was overridden to remove the
corresponding url.
2013-08-22 10:08:54 -04:00
Anssi Kääriäinen 6af05e7a0f Fixed model.__eq__ and __hash__ for no pk value cases
The __eq__ method now considers two instances without primary key value
equal only when they have same id(). The __hash__ method raises
TypeError for no primary key case.

Fixed #18864, fixed #18250

Thanks to Tim Graham for docs review.
2013-08-22 17:24:07 +03:00
Anssi Kääriäinen 8d65b6082c Fixed #20955 -- select_related regression
In cases where the same connection (from model A to model B along the
same field) was needed multiple times in a select_related query, the
join setup code mistakenly reused an existing join.
2013-08-22 10:51:07 +03:00
Tim Graham 3f416f6379 Fixed a regression with get_or_create and virtual fields.
refs #20429

Thanks Simon Charette for the report and review.
2013-08-21 22:32:04 +01:00
Ramiro Morales c7364a11f6 Switched mail tests to SimpleTestCase. 2013-08-21 22:32:04 +01:00
Ramiro Morales 8e571e5f8f Fixed #12422 -- Don't override global email charset behavior for utf-8.
Thanks simonb for the report, Claude Paroz and Susan Tan for their work
on a fix.
2013-08-21 22:32:04 +01:00
Anssi Kääriäinen 244e2b71f5 Fixed #20946 -- model inheritance + m2m failure
Cleaned up the internal implementation of m2m fields by removing
related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing
if asked for the foreign key value on foreign key to parent model's
primary key when child model had different primary key field.
2013-08-21 22:32:04 +01:00
Ramiro Morales c5fbd16362 Import test case classes from their public API module. 2013-08-21 22:32:04 +01:00
Ramiro Morales 01223840f3 Fixed #18967 -- Don't base64-encode message/rfc822 attachments.
Thanks Michael Farrell for the report and his work on the fix.
2013-08-21 22:32:04 +01:00
Florian Apolloner 839940f27f Fixed #20933 -- Allowed loaddata to load fixtures from relative paths. 2013-08-21 22:32:04 +01:00
Anssi Kääriäinen 3a8ae71ab5 Fixed invalid testing fixture 2013-08-21 22:31:50 +01:00
Anssi Kääriäinen f5552571dc Fixed #20820 -- Model inheritance + m2m fixture loading regression
Tests by Tim Graham, report from jeroen.pulles@redslider.net.
2013-08-21 22:31:50 +01:00
Anssi Kääriäinen ced3e6b17d Fixed test failure caused by different NULL ordering between backends 2013-08-21 22:31:50 +01:00
Anssi Kääriäinen cea7204504 Fixed #14056 -- Made sure LEFT JOIN aren't trimmed in ORDER BY
If LEFT JOINs are required for correct results, then trimming the join
can lead to incorrect results. Consider case:

TBL A: ID | TBL B: ID  A_ID
       1           1   1
       2
Now A.order_by('b__a') did use a join to B, and B's a_id column. This
was seen to contain the same value as A's id, and so the join was
trimmed. But this wasn't correct as the join is LEFT JOIN, and for row
A.id = 2 the B.a_id column is NULL.
2013-08-21 22:30:46 +01:00
Anssi Kääriäinen b773ef8fa0 Fixed #14043 -- Made sure nullable o2o delete works as expected
There was an old complaint about nullable one-to-one field cascading
even when the o2o field was saved to None value before the deletion.
Added an test to verify this doesn't happen.

Also some PEP 8 cleanup.
2013-08-21 22:30:45 +01:00
Simon Charette 63378163f9 Fixed #20943 -- Weakly reference senders when caching their associated receivers 2013-08-21 22:30:45 +01:00
Simon Charette 77478d84ad Fixed an aggregation test failure on MySQL. 2013-08-21 22:30:02 +01:00
Andrew Godwin 2e7f45a372 Change autodetector changes API to be just one method 2013-08-21 22:25:15 +01:00
Tim Graham f7290581fe Fixed a regression with get_or_create and virtual fields.
refs #20429

Thanks Simon Charette for the report and review.
2013-08-21 08:30:21 -04:00
Ramiro Morales a5cf5da50d Switched mail tests to SimpleTestCase. 2013-08-21 07:48:16 -03:00
Ramiro Morales ececbe77ff Fixed #12422 -- Don't override global email charset behavior for utf-8.
Thanks simonb for the report, Claude Paroz and Susan Tan for their work
on a fix.
2013-08-21 07:44:20 -03:00
Anssi Kääriäinen b065aeb17f Fixed #20946 -- model inheritance + m2m failure
Cleaned up the internal implementation of m2m fields by removing
related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing
if asked for the foreign key value on foreign key to parent model's
primary key when child model had different primary key field.
2013-08-21 08:32:19 +03:00
Ramiro Morales deebb1a977 Import test case classes from their public API module. 2013-08-20 22:23:41 -03:00
Ramiro Morales f9d1d5dc13 Fixed #18967 -- Don't base64-encode message/rfc822 attachments.
Thanks Michael Farrell for the report and his work on the fix.
2013-08-20 22:17:26 -03:00
Florian Apolloner 96346ed5ad Fixed #20933 -- Allowed loaddata to load fixtures from relative paths. 2013-08-20 21:25:57 +02:00
Anssi Kääriäinen 86f4459f9e Fixed invalid testing fixture 2013-08-20 17:48:02 +03:00
Anssi Kääriäinen 1ed77e7782 Fixed #20820 -- Model inheritance + m2m fixture loading regression
Tests by Tim Graham, report from jeroen.pulles@redslider.net.
2013-08-20 16:54:05 +03:00
Anssi Kääriäinen 8dc76c4b91 Fixed test failure caused by different NULL ordering between backends 2013-08-20 11:33:44 +03:00
Anssi Kääriäinen 905409855c Fixed #14056 -- Made sure LEFT JOIN aren't trimmed in ORDER BY
If LEFT JOINs are required for correct results, then trimming the join
can lead to incorrect results. Consider case:

TBL A: ID | TBL B: ID  A_ID
       1           1   1
       2
Now A.order_by('b__a') did use a join to B, and B's a_id column. This
was seen to contain the same value as A's id, and so the join was
trimmed. But this wasn't correct as the join is LEFT JOIN, and for row
A.id = 2 the B.a_id column is NULL.
2013-08-20 10:55:00 +03:00
Anssi Kääriäinen b53ed351b3 Fixed #14043 -- Made sure nullable o2o delete works as expected
There was an old complaint about nullable one-to-one field cascading
even when the o2o field was saved to None value before the deletion.
Added an test to verify this doesn't happen.

Also some PEP 8 cleanup.
2013-08-20 09:50:37 +03:00
Simon Charette e55ca60903 Fixed #20943 -- Weakly reference senders when caching their associated receivers 2013-08-20 01:53:58 -04:00
Simon Charette fdbf492946 Fixed an aggregation test failure on MySQL. 2013-08-19 20:39:30 -04:00
Andrew Godwin b6a957f0ba Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	docs/ref/django-admin.txt
2013-08-19 18:30:48 +01:00
Rainer Koirikivi 3c03004050 Fixed #20640 -- Avoided NoReverseMatch in get_deleted_objects
The default delete action resulted in a NoReverseMatch if it were to
list any Model with a ModelAdmin with `get_urls` overridden to remove
the change url.  Catching the error and not displaying the link in that
case, as was already done for models with no registered admins.

Thanks Keryn Knight for the report.
2013-08-19 12:01:33 -04:00
Anssi Kääriäinen 58c6d0209d Fixed #12807 -- EmptyResultSet ORed condition
The EmptyResultSet wasn't treated correctly so the end results was
incorrect, too. The bug had been already fixed in master so only tests
added.
2013-08-19 16:24:45 +03:00
Anssi Kääriäinen 7bc57a6d71 Fixed #11881 -- removed junk from aggregation subqueries
There were clauses that weren't needed in the subqueries. These were
ORDER BY, SELECT FOR UPDATE and related selections.
2013-08-19 16:15:09 +03:00
Anssi Kääriäinen 7737305a4f Fixed #12886 -- aggregation over sliced queryset 2013-08-19 16:00:17 +03:00
Andrew Godwin 52edc16086 Add more stringent M2M tests and fix the bug they exposed 2013-08-19 13:50:26 +01:00
Anssi Kääriäinen 7d28bed13b PEP 8 cleanup 2013-08-19 14:16:10 +03:00
Anssi Kääriäinen 630b9df42f Fixed #12567 -- Incorrect SQL in model inheritance case
An isnull lookup produced incorrect SQL. This was already fixed
earlier, so only tests added.
2013-08-19 14:10:03 +03:00
Anssi Kääriäinen 3844089edc Fixed #20777 -- Admin proxy model deletion regression
Added proxy_models tests by Harm Geerts <github@geertswei.nl>.
2013-08-19 09:51:41 +03:00
Anssi Kääriäinen 4668c142dc Made Model.__eq__ consider proxy models equivalent
Fixed #11892, fixed #16458, fixed #14492.
2013-08-19 09:51:28 +03:00
Alex Gaynor aa01c99f55 Merge pull request #1479 from nickbruun/ticket_20924
Proxy __len__ and __contains__ for LazyObject
2013-08-18 09:41:43 -07:00
Claude Paroz 165f44aaaa Combine consecutive with statements
Python 2.7 allows to combine several 'with' instructions.
2013-08-16 20:12:10 +02:00
Alasdair Nicol 22c6497f99 Fixed #20895 -- Made check management command warn if a BooleanField does not have a default value
Thanks to Collin Anderson for the suggestion and Tim Graham for
reviewing the patch.
2013-08-15 19:47:26 -04:00
Nick Bruun b9ef96e73c Regression test and patch for ticket #20924. 2013-08-15 20:59:58 +02:00
Jonathan Slenders ff410565bf Fixed #20709 -- Allowed {% widthratio %} to accept an "as" parameter.
Thanks clay.evil@ for the suggestion.
2013-08-14 12:40:19 -04:00
Florian Apolloner 4e50e40654 Removed unneeded conditional_escapes from the testsuite. 2013-08-13 22:22:46 +02:00
Andrew Godwin 157604a87f Oracle schema backend, passes most tests and is pretty complete. 2013-08-13 20:54:57 +01:00
Matt Johnson 907ef9d0d1 Fixed #20555 -- Make subwidget id attribute available
In `BoundField.__iter__`, the widget's id attribute is now passed to
each subwidget. A new id_for_label property was added to ChoiceInput.
2013-08-13 13:23:05 -04:00
Jacob Kaplan-Moss cbe6d5568f Apply autoescaping to AdminURLFieldWidget.
This is a security fix; disclosure to follow shortly.
2013-08-13 11:06:41 -05:00
Anssi Kääriäinen 09a5f5aabe Fixed test failure on MySQL
The fix for #20874 caused a MySQL specific failure.
2013-08-13 15:37:08 +03:00
Loic Bistuer 163a34ce4b Fixed #20883 -- Made model inheritance find parent links in abstract parents 2013-08-13 15:14:11 +03:00
Anssi Kääriäinen dcdc579d16 Fixed #20874 -- bump_prefix() in nested subqueries
Also made some cleanup to build_filter() code by introducing submethods
solve_lookup_type() and prepare_lookup_value().
2013-08-13 14:11:52 +03:00
Ramiro Morales 6c12cd15e9 Unlocalize line numbers and ids in debug 500 view.
While using USE_L10N, line numbers and IDs were printed as comma (or
locale equivalent) separated values.

Thanks Kronuz for the report and intial patch.

Fixes #20861.
2013-08-12 21:59:27 -03:00
Tim Graham 71b5617c24 Fixed #17778 -- Prevented class attributes on context from resolving as template variables.
Thanks KyleMac for the report, regebro for the patch, and Aymeric for the test.
2013-08-12 12:41:39 -04:00
Mel Collins 6bdb3b1135 Fixed #13518 -- Added FILE_UPLOAD_DIRECTORY_PERMISSIONS setting
This setting does for new directories what FILE_UPLOAD_PERMISSIONS
does for new files.

Thanks jacob@ for the suggestion.
2013-08-12 07:15:59 -04:00
Andrew Godwin b61b634628 Fix weird planning issues when already fully migrated. 2013-08-11 15:28:51 +01:00
Andrew Godwin ae19315b4d Support index_together during model creation 2013-08-11 14:23:31 +01:00
Ramiro Morales 22af1394c6 Expand testing of Test LiveServerTestCase static files serving. 2013-08-10 16:32:07 -03:00
Ramiro Morales cb92e3391b Test that django.views.static.serve() generates 404 status codes.
Also, change tests to be based on SimpleTestCase.
2013-08-10 16:00:22 -03:00
Bojan Mihelac 0cac4fbf69 Fixed #18356 -- Gave the test client signals.template_rendered call a unique dispatch_uid
This prevents the test client context from being lost when the client
is used in a nested fashion.
2013-08-09 12:22:42 -04:00
Andrew Godwin 588b523233 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/options.py
2013-08-09 14:37:37 +01:00
Andrew Godwin de64c4d6e9 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/core/management/commands/flush.py
	django/core/management/commands/syncdb.py
	django/db/models/loading.py
	docs/internals/deprecation.txt
	docs/ref/django-admin.txt
	docs/releases/1.7.txt
2013-08-09 14:17:30 +01:00
Tim Graham 9c711ee3a6 Fixed test failures on Python 3 - refs #12288 2013-08-09 09:12:15 -04:00
Tim Graham b575d690bb Fixed test failures introduced by #12288 2013-08-09 08:34:37 -04:00
SusanTan 2ac89012d8 Fixed #12288 -- Added unique validation for INSTALLED_APPS 2013-08-09 08:08:34 -04:00
Marc Tamlyn 1c4a9bd9ad Revert change to the default Form.clean()
This means it doesn't break for people who are doing
`cleaned_data = super(FooForm, self).clean()`.
2013-08-08 14:27:48 +01:00
Marc Tamlyn fb1dd6b13a Form.clean() does not need to return cleaned_data.
If it does, that will be used as the cleaned_data. The default
implementation has been changed to match this change.
2013-08-08 14:05:55 +01:00
Anssi Kääriäinen c7739e30b2 Fixed #17424 -- annotate() + exclude() bug
The bug was already fixed by 01b9c3d519,
so only tests added.

At the same time promote_joins()'s uncoditional flag is gone, it isn't
needed for anything any more.
2013-08-07 12:53:33 +03:00
Collin Anderson d53e574676 Fixed #20865 -- Fixed raw_id_fields to work with callable limit_choices_to. 2013-08-06 13:41:52 -04:00
Alex Cucu 1c64a0f29e Fixed #19918 -- Modified select_for_update to run on the write database. 2013-08-06 09:50:59 -04:00
Tai Lee 1280675834 Fixed #15511 -- Allow optional fields on ``MultiValueField` subclasses.
The `MultiValueField` class gets a new ``require_all_fields`` argument that
defaults to ``True``. If set to ``False``, individual fields can be made
optional, and a new ``incomplete`` validation error will be raised if any
required fields have empty values.

The ``incomplete`` error message can be defined on a `MultiValueField`
subclass or on each individual field. Skip duplicate errors.
2013-08-06 08:50:47 -04:00
Marc Tamlyn 0b771fcf29 Merge pull request #1441 from loic/ticket16986
Fixed #16986 -- Model.clean() can report errors on individual fields.
2013-08-06 02:10:45 -07:00
Anssi Kääriäinen 263b873599 Fixed ordering related test failure
Also PEP8 + python_2_unicode_compatible cleanup done.
2013-08-06 10:07:52 +03:00
Loic Bistuer 71093d22b6 Fixed #16986 -- Model.clean() can report errors on individual fields.
This commit provides the tests for this issue but the actual problem was solved
by the ValidationError refactor in f34cfec and ee77d4b.

Refs #20199.
2013-08-06 02:26:51 +07:00
Tim Graham 04489c7dbf Fixed #17667 -- Prevented app loading from skipping nonexistent apps after the first try
Thanks ea2100@ for the report and akaariai for the patch.
2013-08-05 13:34:35 -04:00
Tim Heap 75c87e2d38 Fixed #20850 -- Added MultiWidget.needs_multipart_form 2013-08-05 10:02:28 -04:00
Julien Phalip f067887a4f Fixed some intermittent Selenium test failures. 2013-08-04 22:03:53 -07:00
Julien Phalip 995ffbb2a6 Added some Selenium tests for the admin raw id widget. 2013-08-04 16:08:45 -07:00
Loic Bistuer ebb3e50243 Introduced ModelAdmin.get_fields() and refactored get_fieldsets() to use it.
Refs #18681.

This also starts the deprecation of ModelAdmin.declared_fieldsets
2013-08-04 09:14:18 -04:00
Curtis Maloney 07876cf02b Deprecated SortedDict (replaced with collections.OrderedDict)
Thanks Loic Bistuer for the review.
2013-08-04 07:09:39 -04:00
Aymeric Augustin 784377544e Fixed #20822 -- Set content type of default error pages to 'text/html'.
Thanks Jimmy Song for the patch.
2013-08-04 11:04:37 +02:00
Loic Bistuer 0bcdcc7eb9 Added ModelAdmin.get_search_fields. 2013-08-03 20:02:43 -04:00
Petr Dlouhý 1b47508ac8 Fixed LogEntry.get_admin_url() for non-existent models.
Regression introduced by [369b6fa]; refs #18169.
2013-08-02 12:51:10 -04:00
Loic Bistuer a0ed2f9260 Fixed #18681 -- GenericInlineModelAdmin.get_formset() no longer bypasses get_fieldsets().
Refs 23e1b59 which already fixed this issue for ModelAdmin and InlineModelAdmin.
2013-08-02 10:41:29 -04:00
Aleksandra Sendecka 893d8de6f5 Fixed #18777 -- Localized form fields with as_text/as_hidden
Thanks croldan for the report.
2013-08-02 08:41:54 -04:00
Tim Graham aa830009de Fixed #17519 -- Fixed missing SQL constraints to proxy models.
Thanks thibaultj for the report, jenh for the patch,
and charettes for the tests.
2013-08-02 07:41:56 -04:00
Alex Couper 1123f45511 Fixed #20649 -- Allowed blank field display to be defined in the initial list of choices. 2013-07-31 14:12:03 -04:00
Will Hardy 1c3c21b38d Fixed #19987 -- Disabled host validation when DEBUG=True.
The documentation promises that host validation is disabled when
DEBUG=True, that all hostnames are accepted. Domains not compliant with
RFC 1034/1035 were however being validated, this validation has now been
removed when DEBUG=True.

Additionally, when DEBUG=False a more detailed SuspiciousOperation
exception message is provided when host validation fails because the
hostname is not RFC 1034/1035 compliant.
2013-07-31 10:38:59 -04:00
Loic Bistuer acd1d439fd Fixed #20826 -- Moved Manager.raw() and Manager._insert() to the QuerySet class. 2013-07-31 09:54:00 -04:00