Commit Graph

16448 Commits

Author SHA1 Message Date
Anssi Kääriäinen 01e8ac47b3 PEP-8 cleanup
Refs #21169
2013-11-27 19:45:47 +02: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 0b3c8fc851 Update tutorial part 1 to discuss migrations properly 2013-11-27 16:29:49 +00: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 19b34fbe63 Field.deconstruct() howto docs 2013-11-27 15:20:53 +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
Andrew Godwin 0c46ca83e8 Merge pull request #1985 from raphaa/21499
Fixed #21499 -- Migrations won't work if field signature changes
2013-11-26 12:33:52 -08:00
Alex Gaynor ac17525039 Replace use of dict.has_key with `key in dict` 2013-11-26 14:32:14 -06:00
Alex Gaynor bb5ab908cc Fixed a typo in the documentation 2013-11-26 13:49:54 -06: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
Vajrasky Kok 16d73d7416 Fixed #21512 -- Added more complete information about Pillow and PIL in model_fields and model_forms tests. 2013-11-26 10:18:54 +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 7349a22d29 flake8 fix 2013-11-25 09:21:25 -06:00
Shai Berger 3411af3cd1 Fixed #21403: Corrected test code
A test for annotations incorrectly assumed that the first instance
(in the test) of a model using AutoField for PK will always get pk=1.
The test was changed to compare against actual instance id instead.
2013-11-25 16:16:04 +02:00
Ludwik Trammer 70e61310d6 Fixed #21507 -- Corrected default widget information for FileField 2013-11-25 08:26:10 -05:00
Shai Berger de220fb85e Fixed test failure on Oracle
Failure was introduced with test in [19e5cd77f0]
2013-11-25 15:11:50 +02:00
Alex Gaynor 83ab04c6d6 flake8 fixes 2013-11-24 21:07:21 -06:00
Alex Gaynor 4e07d93325 Fixed some unnescesarily gendered language in the docs 2013-11-24 21:05:59 -06:00
Simon Charette eb38257e51 Fixed #21391 -- Allow model signals to lazily reference their senders. 2013-11-24 17:51:22 -05:00
Tim Graham 03bc0a8ac5 Fixed typo in previous commit; refs #21490. 2013-11-24 16:28:29 -05:00
Tim Graham bfe7377adb Fixed #21490 -- Fixed custom admin URL reverse example.
Thanks glarrain for the report.
2013-11-24 15:19:05 -05:00
Loic Bistuer 2a0ae9b9ec Removed confusing comments from the docs.
The settings reference documentation doesn't seem the right place to
invite users to write their own db and cache backends.

Also the actual wording makes the task sound trivial, which is hardly
the case; writing a custom db backend is a very difficult task, and
writing a custom cache backend is full of gotcha.
2013-11-24 20:22:22 +01:00
Joel Bohman 19e5cd77f0 Fixed #21497 -- Forced conversion to bytes for very long index names 2013-11-24 13:15:50 -05:00
Antonis Christofides f88e760869 Added more tests for ContentTypeManager.get_for_model. 2013-11-24 18:59:46 +01: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
Alex Gaynor 8adbfdfcc4 Fixed flake8 error (5 space identation!!!) 2013-11-24 08:33:22 -06:00
Raphael Jasjukaitis 455e2896b1 Fixed #21499 -- Added a paragraph to the docs. 2013-11-24 15:26:45 +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 87ea38cc9e Don't fail if there is no memcached backend active. 2013-11-24 12:08:41 +01:00
Florian Apolloner 3ea65d1f68 Fixed regression from ffc37e2343.
This (hopefully) ensures that the cache are created the same way as before
the offending commit.
2013-11-24 11:51:37 +01:00
Vajrasky Kok 7169722d5c Fixed #21505 -- Added unit test for django.utils.text.get_valid_filename. 2013-11-24 11:10:34 +01:00
Florian Apolloner 101da92ebd Randomized KEY_PREFIX in caches test to prevent failures during parallel testruns. 2013-11-24 10:15:43 +01:00
Alex Gaynor ce5ad8199c Merge pull request #1980 from krallin/patch-1
Add missing commas in Prefetch docs
2013-11-23 14:51:10 -08:00
Thomas Orozco 957d22b850 Add missing commas in Prefetch docs 2013-11-23 23:48:34 +01:00
Baptiste Mispelon a739573e17 Fixed test breakage under python 3 introduced by a480f8320a. 2013-11-23 19:50:20 +01:00
Florian Apolloner 9e87444552 Don't fail if cPickle doesn't exist.
Today is not my day :(
2013-11-23 19:05:13 +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
Florian Apolloner e112654fc8 Fixed #21200 -- Consistantly raise errors across all cache backends.
Thanks to tchaumeny for the patch.
2013-11-23 17:50:28 +01:00