Commit Graph

4860 Commits

Author SHA1 Message Date
Claude Paroz 1718b5256c Fixed #21405 -- Prevented queryset overwrite in BaseModelAdmin
Thanks guido@20tab.com for the report and Tim Graham for the
analyze.
2013-11-21 22:18:52 +01:00
Claude Paroz e6d5f7ae49 Made minor optimizations to admin_ordering tests 2013-11-21 20:58:28 +01:00
Unai Zalakain 2b4bed6dbd Fixed #21476 -- Cache tests make an incorrect use of `HttpRequest`
Using `django.test.client.RequestFactory` solves the problem and cleans up all
the `get_request` mess.
2013-11-21 18:51:08 +01:00
Anssi Kääriäinen 752d3d70da Fixed #21431 -- GenRel->FK list_filter regression in admin
Report, analysis and tests from stephenmcd.
2013-11-21 14:52:00 +02:00
Loic Bistuer 8e670a0e50 Refs #8261 -- Fixed regression introduced by fd219fa.
ModelAdmin displayed the "View on site" link even if the Model didn't
define the `get_absolute_url()` method.
2013-11-21 16:26:49 +07:00
Claude Paroz fafb6cf049 Fixed #21472 -- Fixed inline formsets display when parent pk is 0
Thanks agale031176@gmail.com for the report.
2013-11-20 21:36:20 +01:00
Baptiste Mispelon 8f5a688d00 Fixed #21458 -- Made check_for_language more resistant to malformed input.
Thanks to Sergey Sorokin for the report and to Bouke Haarsma for the review.
2013-11-20 17:51:53 +01:00
Baptiste Mispelon 331d79a77d Fixed #21469 -- Allow set objects in Meta.unique_together.
Thanks to Tim for the review.
2013-11-20 17:26:26 +01:00
Vajrasky Kok 68b540c977 Fixed #21361 -- allowed access self.value() from SimpleListFilter lookup
Reviewed by Chris Medrela.
2013-11-19 09:14:22 +02:00
Unai Zalakain 4fdd51b732 Fixed #15179 -- middlewares not applied for test client login()
Requests made with django.test.Client.login() and logout() respect
defaults defined in django.test.Client instantiation and are processed
through middleware.

Thanks to Loic for the reviews.
2013-11-19 09:04:20 +02:00
Loic Bistuer 3f19b63f8b Fixed some Signal.disconnect calls from 058e434.
This would go unnoticed by the test suite because receivers are removed
automatically when they are garbage collected.

Changed all Signal.connect calls to hold strong references to ensure we
clean up after ourselves.
2013-11-18 14:38:28 -05:00
Claude Paroz 97ac22ebfc Fixed #21457 -- Allowed fixture file name to contain dots
Thanks Keryn Knight for the report.
2013-11-18 20:32:13 +01:00
Loic Bistuer 058e434064 Merged the signals and signals_regress test packages.
This patch also made the tests less likely to pollute the global state
in case of failure.
2013-11-18 12:42:51 -05:00
Claude Paroz a0f3eeccf3 Fixed #21397 -- Re-added flexibility to TypedChoiceField coercion
Thanks Elec for the report and Simon Charette for the review.
2013-11-18 18:24:56 +01:00
Anssi Kääriäinen 0e079e4331 Fixed #21428 -- editable GenericRelation regression
The GenericRelation refactoring removed GenericRelations from
model._meta.many_to_many. This had the side effect of disallowing
editable GenericRelations in ModelForms. Editable GenericRelations
aren't officially supported, but if we don't fix this we don't offer any
upgrade path for those who used the ability to set editable=True
in GenericRelation subclass.

Thanks to Trac alias joshcartme for the report and stephencmd and Loic
for working on this issue.
2013-11-16 20:07:35 +02:00
Baptiste Mispelon ceecc962ad Fixed #21447 -- Restored code erroneously removed in 20472aa827.
Also added some tests for HttpRequest.__repr__.
Note that the added tests don't actually catch the accidental code
removal (see ticket) but they do cover a codepath that wasn't tested
before.

Thanks to Tom Christie for the report and the original patch.
2013-11-16 01:09:35 +01:00
Alex Gaynor 10a09b8e60 Fixed the use of the -ise suffix, where -ize is prefered 2013-11-15 05:23:14 -08:00
Loic Bistuer 17ed99f3a3 Fixed #21432 -- DateTimeQuery now copies tzinfo when cloning.
Thanks Enrique Martínez for the report and @bmispelon for the tests.
2013-11-14 21:36:55 +01:00
Loic Bistuer cb83448891 Fixed #21410 -- prefetch_related() for ForeignKeys with related_name='+'
Regression introduced by commit 9777442.

Thanks to trac username troygrosfield for the report and test case.
2013-11-13 07:35:34 +02:00
Alex Gaynor bc742ca110 Flake8 fixes -- including not runnign flake8 over a backported file 2013-11-11 14:05:14 -08:00
Bouke Haarsma 2397daab4a Fixed #9523 -- Restart runserver after compiling apps translations
Django also uses locales provided by apps, which also might change. Also when
i18n is disabled, there is no need for watching translation files.
2013-11-11 11:43:09 +01:00
Bouke Haarsma 9b7455e918 Fixed #21351 -- Replaced memoize with Python's lru_cache.
Replaced the custom, untested memoize with a similar decorator from Python's
3.2 stdlib. Although some minor performance degradation (see ticket), it is
expected that in the long run lru_cache will outperform memoize once it is
implemented in C.

Thanks to EvilDMP for the report and Baptiste Mispelon for the idea of
replacing memoize with lru_cache.
2013-11-11 08:53:09 +01:00
Claude Paroz e6dd70b4db Fixed #21383 -- Added request details in SuspiciousOperation messages 2013-11-09 12:11:58 +01:00
Alex Gaynor ccd11c09c3 Flake8 fix -- correct number of newlines between top level definitions 2013-11-08 09:03:59 -08:00
Unai Zalakain 72f63bd24d Fixed #17529 -- get_template_from_string default arguments break
``get_template_from_string`` default arguments were breaking
``assertTemplateUsed``. The solution has been to return only the names of the
templates with a ``name`` attribute distinct of ``None``. The default ``name``
kwarg of ``Template`` has been changed to ``None``, more pythonic than ``'<Unknown
Template>'``.
2013-11-08 17:10:37 +01:00
Claude Paroz bc21e9c0d9 Fixed #13970 -- Made SelectDateWidget use the standard widget is_required attribute
Thanks mitar for the report and Tim Graham for the review.
2013-11-08 16:58:17 +01:00
Tim Graham 536c447820 Fixed a couple flake8 warnings. 2013-11-07 20:10:25 -05:00
Bouke Haarsma 7a7c789d5a Fixed #5849 -- Strip whitespace from blocktrans
Add the trimmed option to the blocktrans tag to trim any newlines and
whitespace from its content.

This allows the developer to indent the blocktrans tag without adding
new lines and whitespace to the msgid in the PO file.

Thanks to mpessas for the initial patch and Dmitri Fedortchenko for the
report.
2013-11-08 00:52:17 +02:00
Anssi Kääriäinen 30203a0dea Merge pull request #1850 from unaizalakain/ticket_13725
Fixed #13725 -- take url scheme into account in assertRedirects

Thanks to Loic for review.
2013-11-07 14:30:04 -08:00
Unai Zalakain 9c5f6cd565 Fixed #13725 -- take url scheme into account in assertRedirects
Scheme is handled correctly when making comparisons between two URLs. If
there isn't any scheme specified in the location where we are redirected to,
the original request's scheme is used. If present, the scheme in
``expected_url`` is the one used to make the comparations to.
2013-11-07 19:06:32 +01:00
Jaap Roes 7be638390e Fixed #20536 -- rewrite of the file based cache backend
* Safer for use in multiprocess environments
 * Better random culling
 * Cache files use less disk space
 * Safer delete behavior

Also fixed #15806, fixed #15825.
2013-11-07 16:12:15 +02:00
Loic Bistuer f51c1f5900 Fixed #17001 -- Custom querysets for prefetch_related.
This patch introduces the Prefetch object which allows customizing prefetch
operations.

This enables things like filtering prefetched relations, calling select_related
from a prefetched relation, or prefetching the same relation multiple times
with different querysets.

When a Prefetch instance specifies a to_attr argument, the result is stored
in a list rather than a QuerySet. This has the fortunate consequence of being
significantly faster. The preformance improvement is due to the fact that we
save the costly creation of a QuerySet instance.

Thanks @akaariai for the original patch and @bmispelon and @timgraham
for the reviews.
2013-11-07 14:49:49 +02:00
Anssi Kääriäinen b1b04df065 Fixed #20600 -- ordered distinct(*fields) in subqueries 2013-11-07 14:29:50 +02:00
Anssi Kääriäinen e7b61e5717 Fixed #11320 -- exclude() too aggressive in join promotion 2013-11-07 12:57:02 +02:00
Anssi Kääriäinen 6fe2b001db Fixed #21376 -- New implementation for query join promotion logic
This commit introduced a new class JoinPromoter that can be used to
abstract away join promotion problems for complex filter conditions.
Query._add_q() and Query.combine() now use the new class.

Also, added a lot of comments about why join promotion is done the way
it is.

Thanks to Tim Graham for original report and testing the changes, and
for Loic Bistuer for review.
2013-11-07 12:53:26 +02:00
Alex Gaynor e5b7045422 flake8 fixes 2013-11-06 20:00:48 -08:00
Andrew Godwin 106b019dc9 Massive migration optimiser improvements + RenameModel opn 2013-11-06 13:47:58 +00:00
Baptiste Mispelon b914991b37 Added more tests and documentation for dictsort.
It's possible to use something like {{ foo|dictsort:'bar.baz' }}
but this wasn't tested or documented.
2013-11-06 00:26:58 +01:00
Bouke Haarsma e5e044da87 Fixed #18419 -- Full backwards compatibility for old language codes
Improved documentation about zh-* deprecation and upgrade path.

Thanks to Baptiste Mispelon for the code reviews.
2013-11-05 19:26:58 +01:00
Anssi Kääriäinen 76da053641 Fixed #10461 -- bug in generic relation + annotate() case
This issue was fixed when the contenttype restriction was moved from
where clause to the join clause. So, this is tests only addition.
2013-11-05 20:02:24 +02:00
Bouke Haarsma c0a2388a1c Fixed #18149 -- Changed language codes for Chinese
Language codes for Chinese are zh_Hans (Simplified) and zh_Hant (Traditional).
Added support for browsers that still send the deprecated language codes.

Thanks to Olli Wang for the report.
2013-11-04 23:03:28 +01:00
Aymeric Augustin cb2c3ce154 Merge pull request #1821 from Bouke/tickets/14170
#14170 -- Reset i18n cache when settings changed
2013-11-04 13:50:21 -08:00
Bouke Haarsma 9b95fa7777 Fixed #21322 -- Error message when CSRF cookie is missing
Thanks to Henrik Levkowetz and olau for their reports and initial patches.
2013-11-03 20:05:10 +01:00
Alex Gaynor f67e18f39e Fixed all E251 violations 2013-11-03 10:17:58 -08:00
Alex Gaynor c347f78cc1 Fixed all E226 violations 2013-11-03 10:08:55 -08:00
Alex Gaynor 7288e1b02b Merge pull request #1852 from jasonamyers/cleanup/PEP8
Cleanup/pep8 tests
2013-11-03 09:51:49 -08:00
Jason Myers 4f151da1e5 Merging in master
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-03 07:19:25 -06:00
Florian Apolloner 08e2ecee3b Fixed some testfailures on jenkins.
Depending on the order of the tests beeing run, 10 can be a valid pk,
0 can never be a valid pk and as such we will get the wanted ValidationError.
2013-11-03 14:16:48 +01:00
Jim Bailey 539e3693d4 Fixed #20849 -- ModelForms do not work well with prefetch_related.
model_to_dict() (used when rendering forms) queries the database
to get the list of primary keys for ManyToMany fields. This is
unnecessary if the field queryset has been prefetched, all the
keys are already in memory and can be obtained with a simple
iteration.
2013-11-03 12:27:54 +02:00
Bouke Haarsma d0669843d0 Fixed #14170 -- Reset i18n cache when settings change 2013-11-03 09:36:09 +01:00