Commit Graph

1227 Commits

Author SHA1 Message Date
Russell Keith-Magee 214c79219e Fixed #10589 -- Removed duplicated model definition in null_fk_ordering regression test. Thanks to Julien Phalip for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-24 11:35:48 +00:00
Malcolm Tredinnick fd46f673bd Fixed #9926 -- Fixes for some select_related() situations.
Using select_related(...) across a nullable relation to a multi-table
model inheritance situation no longer excludes results. Thanks to AdamG
for a test demonstrating part of the problem.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10136 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-24 03:59:38 +00:00
Malcolm Tredinnick e5a8d9e810 A bunch of improvements for conditional HTTP processing.
Fixed some typos in the code (fixed #10586). Added more tests. Made the
tests compatible with Python 2.3. Improved the documentation by putting
the good news and common use-case right up front.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10134 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-24 03:01:46 +00:00
Ian Kelly 64ddff1b11 Fixed a false failure in the test suite when running Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10125 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 22:01:16 +00:00
Jacob Kaplan-Moss f0560dfdb2 Fixed #9282: added a generic comment moderation toolkit. See the documentation for details.
This began life as (part of) James Bennett's comment-utils app, and was adapted to be part of Django by Thejaswi Puthraya and Jannis Leidel. Thanks, all!

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10122 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 21:07:02 +00:00
Jacob Kaplan-Moss 44f3080226 Fixed #10505: added support for bulk admin actions, including a globally-available "delete selected" action. See the documentation for details.
This work started life as Brian Beck's "django-batchadmin." It was rewritten for inclusion in Django by Alex Gaynor, Jannis Leidel (jezdez), and Martin Mahner (bartTC). Thanks, guys!

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10121 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 20:22:56 +00:00
Malcolm Tredinnick 7db24dd2b0 Fixed #5756, #6296 -- Most template tags can now handle filters in arguments.
Most of the hard work for this was done by akaihola.

There are still possibly some problems with the i18n template tags,
since they are written quite differently and a few other bug fixes have
to made before they can be fixed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 09:42:51 +00:00
Malcolm Tredinnick a6f429e37e Added consistent support for double- and single-quote delimiters in templates.
Some template filters and tags understood single-quoted arguments, others
didn't. This makes everything consistent. Based on a patch from akaihola.

Fixed #7295.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 09:40:25 +00:00
Malcolm Tredinnick f5c07f89e3 Removed an invalid template test (translating an empty string is a bad idea).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10117 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23 09:19:45 +00:00
Malcolm Tredinnick 3bb68004ff Fixed #10581 -- Fixed conditional handling of If-Match headers.
The conditional processing decorator from r10114 wasn't parsing ETags
from an If-Match header correctly. Patch from Ivan Sagalaev (who also
did most of the work in r10114, before I rewrote parts of it and added
bonus bugs, although I forgot to thank him there).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-22 23:16:03 +00:00
Karen Tracey 14b160957e Fixed #8962 -- Consistently support format and input_format in the various (individual, combined, split) date and time form fields and widgets.
Many thanks to Tai Lee for doing all the work here.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@10115 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-22 16:13:06 +00:00
Malcolm Tredinnick b203db6ec8 Fixed #5791 -- Added early-bailout support for views (ETags and Last-modified).
This provides support for views that can have their ETag and/or Last-modified
values computed much more quickly than the view itself. Supports all HTTP
verbs (not just GET).

Documentation and tests need a little more fleshing out (I'm not happy with the
documentation at the moment, since it's a bit backwards), but the functionality
is correct.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10114 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-22 07:58:29 +00:00
Malcolm Tredinnick 5ac154e065 Fixed deferred loading of fields with default values.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-22 01:45:22 +00:00
Jacob Kaplan-Moss d7e8127524 Fixed #10194: added `django.shortcuts.redirect`, a do-what-I-mean redirect shortcut. See the docs at topics/http/shortcuts for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10108 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-21 13:09:13 +00:00
Malcolm Tredinnick fa89fdcd6b Fixed #2698 -- Fixed deleting in the presence of custom managers.
A custom manager on a related object that filtered away objects would prevent
those objects being deleted via the relation. This is now fixed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10104 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 03:57:12 +00:00
Malcolm Tredinnick 255cb391d1 Fixed #10547 -- Worked around some odd behaviour in Python 2.3 and 2.4.
Calling the super() version of __reduce__ in Model.__reduce__ led to infinite
loops in Python prior to 2.5. We don't do that any longer.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 01:37:11 +00:00
Malcolm Tredinnick 466198c4d9 Added a test for defer() / only() to make sure saving continues to work.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10092 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-19 22:46:28 +00:00
Malcolm Tredinnick 29050ef999 Fixed #5420 -- Added support for delayed loading of model fields.
In extreme cases, some fields are expensive to load from the database
(e.g. GIS fields requiring conversion, or large text fields). This
commit adds defer() and only() methods to querysets that allow the
caller to specify which fields should not be loaded unless they are
accessed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10090 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-19 09:06:04 +00:00
Russell Keith-Magee ee2f04d79e Fixed #10482 -- Unified access to response.context when inspecting responses from the test client. Thanks to James Bennett for the design, and Julien Phalip for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 10:46:55 +00:00
Malcolm Tredinnick 61a2708c41 Fixed #10356 -- Added pure-Python inheritance for models (a.k.a proxy models).
Large portions of this are needed for #5420, so I implemented it fully.
Thanks to Ryan Kelly for an initial patch to get this started.

Refs #5420.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10083 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 09:47:08 +00:00
Malcolm Tredinnick 324eba99cb Fixed #10526 -- More fixes when specifying installed apps using "foo.*".
This adds a case that was missed in r9924: underscore handling.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10078 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 00:59:40 +00:00
Jacob Kaplan-Moss 7bc0878922 Fixed #8939: added a `list_editable` option to `ModelAdmin`; fields declared `list_editable` may be edited, in bulk, on the changelist page. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10077 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-17 20:51:47 +00:00
Russell Keith-Magee 25e1c39bc3 Fixed #10517 -- Corrected cache name for file-based cache tests so that the filename can be valid under Windows. Thanks to Bob Thomas for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10071 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-17 10:40:04 +00:00
Russell Keith-Magee cf7a3fa7f0 Fixed #10512 -- Corrected the handling of extra fields on a ModelForm. Thanks to Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10070 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-17 10:30:17 +00:00
Russell Keith-Magee 7be4b9a4c0 Fixed #8164 -- Fields on a ModelForm are now ordered in the order specified in the fields attribute of the ModelForm's Meta class. Thanks to Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10062 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-15 05:05:26 +00:00
Malcolm Tredinnick 7d9b29a56d Use plain model.Manager, or suitable proxy, for model saving.
We can't use the default manager in Model.save_base(), since we need to
retrieve existing objects which might be filtered out by that manager. We now
always use a plain Manager instance at that point (or something that can
replace it, such as a GeoManager), making all existing rows in the
database visible to the saving code.

The logic for detecting a "suitable replacement" plain base is the same as for
related fields: if the use_for_related_fields is set on the manager subclass,
we can use it. The general requirement here is that we want a base class that
returns the appropriate QuerySet subclass, but does not restrict the rows
returned.

Fixed #8990, #9527.

Refs #2698 (which is not fixed by this change, but it's the first part of a
larger change to fix that bug.)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10056 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-15 03:41:33 +00:00
Russell Keith-Magee 84ce18fc9b Fixed #10425 -- Corrected the interaction of .count() with .annotate() when .values() is also involved. Thanks to kmassey for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-14 04:32:52 +00:00
Ian Kelly 0ae95f80b4 Fixed #10238: coerce TextField values to unicode in the oracle backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10049 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 19:57:00 +00:00
Russell Keith-Magee 6d17020c1a Fixed #10250 -- Added a regression test to ensure that GROUP BY statements are correctly quoted under MySQL. This appears to have been corrected inadvertently since the original report, but the extra regression test will make sure it stays that way.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10043 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 11:52:55 +00:00
Russell Keith-Magee 638dbc3e83 Fixed #6464 -- Added incr() and decr() operations on cache backends. Atomic on Memcache; implemented as a 2 stage retrieve/update on other backends. Includes refactor of the cache tests to ensure all the backends are actually tested, and a fix to the DB cache backend that was discovered as a result. Thanks to Michael Malone for the original patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 13:27:03 +00:00
Ian Kelly 7daf0b9407 Refs #10443: Added Oracle to the #10443 regression test exemption, since we don't yet support it.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10024 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 22:48:42 +00:00
Russell Keith-Magee 3c8568a7dc Fixed #10271, #10281 -- Fixed the handling multiple inline models that share a common base class and have the link to the inline parent on the base class. Includes modifications that allow the equivalent handling for GenericFields. Thanks to Idan Gazit, Antti Kaihola (akaihola), and Alex Gaynor for their work on this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10017 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 11:19:26 +00:00
Malcolm Tredinnick d0fff8ccd4 Fixed #10439 -- Fixed a subtle test failure caused by r9994.
Thanks to Ramiro Morales for debugging what was going on here.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 05:51:06 +00:00
Malcolm Tredinnick 0516c5d921 Fixed #10443 -- Fixed model attribute updating after r10003.
Adding a get_db_prep_save() call to the UpdateQuery code path meant it
was being called twice if you updated an existing model attribute. This
change removes that double call and also makes TimeField.to_python() a
little more robust for the benefit of the Oracle backend (just in case).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10013 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 05:24:19 +00:00
Malcolm Tredinnick ec9c03ce0b Added an editorial comment to a test.
This is to stop me trying to "fix" that piece of code again in the future.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10012 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 05:23:42 +00:00
Malcolm Tredinnick b4dd4d4bb7 Fixed #3163 -- Add a "Meta.managed" option to models.
This allows a model to be defined which is not subject to database table
creation and removal. Useful for models that sit over existing tables or
database views.

Thanks to Alexander Myodov, Wolfgang Kriesing and Ryan Kelly for the bulk of
this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-09 03:35:02 +00:00
Malcolm Tredinnick 6e415a5f90 Fixed #9508 -- Added an appropriate FileField.__hash__ implementation.
Required because we declare a custom __eq__ method.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 09:59:17 +00:00
Malcolm Tredinnick 242fc60520 Fixed #9323 -- Allow glob loading in INSTALLED_APPS to handle digits in names.
Patch from carljm.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9994 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 09:39:48 +00:00
Malcolm Tredinnick cd99c62e2d Fixed #10432 -- Handle all kinds of iterators in queryset filters.
Only consumes the iterators once and works with Python 2.3.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 03:32:16 +00:00
Malcolm Tredinnick 53da1e4794 Fixed #9649 -- Better error handling in model creation.
Previously, you could explicitly assign None to a non-null ForeignKey
(or other) field when creating the model (Child(parent=None), etc). We
now throw an exception when you do that, which matches the behaviour
when you assign None to the attribute after creation.

Thanks to ales.zoulek@gmail.com and ondrej.kohout@gmail.com for some
analysis of this problem.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 04:51:05 +00:00
Malcolm Tredinnick 923f78f504 Improved table join handling for comparisons against NULL.
This fixes a broad class of bugs involving filters that look for missing
related models and fields. Most of them don't seem to have been reported
(the added tests cover the root cause). The exception is that this has
also fixed #9868.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9979 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 02:02:09 +00:00
Malcolm Tredinnick f9c8eeb311 Fixed #10406 -- Fixed some problems with model inheritance and pk fields.
Manually specifying both a OneToOneField(parent_link=True) and separate a
primary key field was causing invalid SQL to be generated. Thanks to Ramiro
Morales for some analysis on this one.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 07:21:14 +00:00
Malcolm Tredinnick dfd7a6c781 Fixed #10251 -- Fixed model inheritance when there's also an explicit pk field.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 07:20:08 +00:00
Malcolm Tredinnick 0e93f60c7f Fixed #10362 -- An update() that only affects a parent model no longer crashes.
This includes a fairly large refactor of the update() query path (and
the initial portions of constructing the SQL for any query). The
previous code appears to have been only working more or less by accident
and was very fragile.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 05:34:01 +00:00
Malcolm Tredinnick dfddf129f0 Fixed #9701 -- Added a "safeseq" template filter.
This is like "safe", except it operates on the individual elements of a
sequence, rather than treating the whole argument as a string.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-02 08:16:33 +00:00
Malcolm Tredinnick 851461aa72 Fixed #10181 -- Handle an EmptyResultSet exception case properly in nested querysets.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-02 06:08:02 +00:00
Malcolm Tredinnick cf3071242a Factor out some common pieces of django.conf.LazySettings.
This is in preparation for some reuse elsewhere in the core code.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9945 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-02 04:48:22 +00:00
Malcolm Tredinnick ec710220dd Fixed some test output in the wake of r9940.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9944 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-02 04:17:00 +00:00
Malcolm Tredinnick 152d517878 Fixed a misnamed test that was inadvertently hiding an earlier one.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9929 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 06:54:38 +00:00
Malcolm Tredinnick c6a404d1e9 Fixed insert/update handling when no database interaction is required.
Fixed #10205 as part of this.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 01:56:59 +00:00