Commit Graph

10035 Commits

Author SHA1 Message Date
Vajrasky Kok 7e2d61a972 Fixed #21380 -- Added a way to set different permission for static directories.
Previously when collecting static files, the directories would receive permissions
from the global umask. Now the default permission comes from FILE_UPLOAD_DIRECTORY_PERMISSIONS
and there's an option to specify the permissions by subclassing any of the
static files storage classes and setting the directory_permissions_mode parameter.
2013-11-29 08:01:30 -05:00
Simon Charette 42ac138009 Fixed a deprecation warning introduced by 96dd48c83f. 2013-11-28 21:42:24 -05:00
Loic Bistuer 91fce675a4 Use 'update_fields' in RelatedManager.clear() when bulk=False.
Thanks Simon Charette for the suggestion.

Refs #21169.
2013-11-29 03:01:08 +07:00
Claude Paroz 34b8a38558 Fixed #21496 -- Fixed crash when GeometryField uses TextInput
Thanks Rhett Garber for the report and initial patch.
2013-11-28 18:29:02 +01:00
Christopher Medrela 7477a4ffde Fixed E125 pep8 warnings 2013-11-28 08:50:11 -05:00
Alex Gaynor a5b94d9d4e A handle of flake8 fixes 2013-11-27 16:42:39 -06:00
Loic Bistuer f450bc9f44 Added a bulk option to RelatedManager remove() and clear() methods
Refs #21169
2013-11-27 19:45:22 +02:00
Anssi Kääriäinen 52015b963d Used simpler queries for m2m clearing when possible.
Refs #21169
2013-11-27 19:45:05 +02:00
Loic Bistuer 17c3997f68 Fixed #21169 -- Reworked RelatedManager methods use default filtering
The `remove()` and `clear()` methods of the related managers created by
`ForeignKey`, `GenericForeignKey`, and `ManyToManyField` suffered from a
number of issues. Some operations ran multiple data modifying queries without
wrapping them in a transaction, and some operations didn't respect default
filtering when it was present (i.e. when the default manager on the related
model implemented a custom `get_queryset()`).

Fixing the issues introduced some backward incompatible changes:

- The implementation of `remove()` for `ForeignKey` related managers changed
  from a series of `Model.save()` calls to a single `QuerySet.update()` call.
  The change means that `pre_save` and `post_save` signals aren't called anymore.

- The `remove()` and `clear()` methods for `GenericForeignKey` related
  managers now perform bulk delete so `Model.delete()` isn't called anymore.

- The `remove()` and `clear()` methods for `ManyToManyField` related
  managers perform nested queries when filtering is involved, which may
  or may not be an issue depending on the database and the data itself.

Refs. #3871, #21174.

Thanks Anssi Kääriäinen and Tim Graham for the reviews.
2013-11-27 19:44:18 +02:00
Andrew Godwin 67b51b9895 Include deferred SQL in sqlmigrate output 2013-11-27 16:29:37 +00:00
Andrew Godwin 5e63977c0e Fixed #21438: makemigrations now detects ManyToManyFields 2013-11-27 15:28:33 +00:00
Andrew Godwin eece3c224e PostGIS schema editor support 2013-11-27 13:32:12 +00:00
Andrew Godwin 4fcfc31865 Add gis deconstruct() method (this does not make schema work) 2013-11-27 12:56:33 +00:00
Andrew Godwin 96dd48c83f Change initial migration writing to work as docs suggest.
Application template now includes an empty migrations module, and
the autodetector will only make initial migrations for apps with
empty modules.
2013-11-27 12:34:31 +00:00
Andrew Godwin db4527e3c0 Fix squashed migration loading ordering issue 2013-11-27 12:29:22 +00:00
Claude Paroz 384816fccb Fixed #21448 -- Fixed test client logout with cookie-based sessions
Thanks Gunnar Scherf for the report and the suggested patch.
2013-11-26 20:41:51 +01:00
Richard Xia 5725236c3e Fixed #21355 -- try importing _imaging from PIL namespace first. 2013-11-26 18:51:39 +02:00
Baptiste Mispelon 9d6c48aeb0 Use str.isupper() to test if a string is uppercased. 2013-11-26 14:08:05 +01:00
Jay Leadbetter c74504c2dd Fixed #20522 - Allowed use of partially validated object in ModelAdmin.add_view formset validation.
Updated ModelAdmin to use form.instance when passing parent model to
child inlines for add_view. There is effectively no change in the
change_view since the previously passed 'obj' is the same as form.instance.

Thanks to meshy for report, and EvilDMP and timo for review.
2013-11-25 20:01:16 -05:00
Loic Bistuer 1c7a83ee8e Fixed #21489 -- Make formsets directly importable from django.forms. 2013-11-25 19:16:19 -05:00
Krzysztof Jurewicz 7a0a3a64a8 Fixed #21509 -- Removed dead exception catching code.
Since Python 2.5, KeyboardInterrupt and SystemExit are not subclasses of
Exception, so explicitly reraising them before the “except Exception” clause
is not necessary anymore.
2013-11-25 16:31:03 +01:00
Alex Gaynor 83ab04c6d6 flake8 fixes 2013-11-24 21:07:21 -06:00
Simon Charette eb38257e51 Fixed #21391 -- Allow model signals to lazily reference their senders. 2013-11-24 17:51:22 -05:00
Joel Bohman 19e5cd77f0 Fixed #21497 -- Forced conversion to bytes for very long index names 2013-11-24 13:15:50 -05:00
Baptiste Mispelon e681b2861d Fixed #21500 -- Removed imports of deprecated utils.importlib 2013-11-24 16:45:01 +01:00
Florian Apolloner d47f794f8f Properly closed cache connections at the end of the request.
This only affects the new cache api and not the deprecated get_cache.

Refs #21012
2013-11-24 16:23:28 +01:00
Baptiste Mispelon 17912522ce Fixed #21504 -- Don't shadow database errors when testing for postgis version.
Thanks to trac user paultag for the report.
2013-11-24 14:34:43 +01:00
Florian Apolloner cf7ddc5765 Follow up to e112654fc8
Actually comitted the code now :þ
2013-11-23 18:55:28 +01:00
Claude Paroz 42fef29446 Fixed #21486 -- Prevented settings config in signal connection
This was particularly problematic in the chain get_wsgi_application
-> db.connections import -> signal connection -> settings configuration.
Thanks Jon Dufresne for the report.
2013-11-23 18:47:47 +01:00
Alex Gaynor 0ec712dd11 A handful of flake8 fixes 2013-11-23 08:26:11 -08:00
Denis Cornehl 1e97058417 Fixes #21412 -- Better error message for messages.add_message
Problem were users calling messages.debug/info/* with a wrong argument
and getting the error "You cannot add messages without installing
MessageMiddleware"

Thanks to trac-user merb for the report.
2013-11-23 17:11:22 +01:00
Aymeric Augustin a480f8320a Simplified iteration in HTTP response objects.
Fixed #20187 -- Allowed repeated iteration of HttpResponse.

All this became possible when support for old-style streaming responses was
finally removed.
2013-11-23 17:03:43 +01:00
Ramiro Morales 62b393c5ae Fixed #21488 -- Multiple locales treatment in i18n commands.
Removed multiple locales separated by commas variation (that wasn't
working as documented) in favor of simply allowing use of the
``--locale``/``-l`` options more than once for ``makemessages`` and
``compilemessages``.

Thanks Romain Beylerian for the report and Claude, Simon for their help.

8750296918 from stable/1.6.x.
2013-11-23 11:53:47 -03:00
Curtis Maloney ffc37e2343 Fixed #21012 -- New API to access cache backends.
Thanks Curtis Malony and Florian Apolloner.

Squashed commit of the following:

commit 3380495e93
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 14:18:07 2013 +0100

    Looked up the template_fragments cache at runtime.

commit 905a74f52b
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 14:19:48 2013 +0100

    Removed all uses of create_cache.

    Refactored the cache tests significantly.

    Made it safe to override the CACHES setting.

commit 35e289fe92
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 12:23:57 2013 +0100

    Removed create_cache function.

commit 8e274f747a
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 12:04:52 2013 +0100

    Updated docs to describe a simplified cache backend API.

commit ee7eb0f73e
Author: Curtis Maloney <curtis@tinbrain.net>
Date:   Sat Oct 19 09:49:24 2013 +1100

    Fixed #21012 -- Thread-local caches, like databases.
2013-11-23 15:06:59 +01:00
Baptiste Mispelon 3ca0815c0b Fixed #21445 -- Clean up misuse of null in quickElement.
Thanks to trac user parsch for the report.
2013-11-23 14:40:01 +01:00
Bouke Haarsma 18185724e6 Fixed #21443 -- Cannot show debug info on PY3's importlib
Thanks productions@zaziork.co.uk for the review.
2013-11-22 20:36:33 +01:00
Bouke Haarsma 48ce09f2f6 Fixed missing admindocs' site_header 2013-11-22 13:30:50 +01:00
Pablo Martín 3ac823fc5b Fixed #21460 -- Reenabled proper template precedence in find_template
Refs #20806. Thanks Unai Zalakain for the review.
2013-11-22 11:09:51 +01:00
Claude Paroz d6cc37d601 Updated admindocs to use class-based views
Thanks Bouke Haarsma for the review.
2013-11-21 22:50:59 +01:00
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
Anssi Kääriäinen f39fd3cd20 Removed isinstance(RelatedObject) checks from admin.utils 2013-11-21 14:52:01 +02: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
xuxiang 4cfe6ba6a3 Use `classmethod` as a decorator. 2013-11-19 23:08:21 -05:00
Alex Gaynor 73b3c257e3 Changed shortcuts from being a package to just being a module 2013-11-19 15:34:20 -08: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