Commit Graph

197 Commits

Author SHA1 Message Date
Malcolm Tredinnick 43809de79d Fixed #1839, #2415, #2536 -- Fixed a generated name clash that was common in
self-referential and circular relations. A lot of community debugging went into
this fix, so thanks to bmurdock@gmail.com, Marek Kubica, ramiro, Michael
Radziej (the last two giving test cases showing the problem) and James Bennett
(who did the hard work to actually diagnose the true problem and fix it).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4676 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-08 03:21:35 +00:00
Malcolm Tredinnick dd99bc7d02 Fixed #3627 -- Made [4659] compatible with Python 2.3. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4662 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-02 05:15:27 +00:00
Jacob Kaplan-Moss a72f908924 Changed the postgres version getting code to use cursor.fetchone() instead of dictfetchone(); some versions (including mine) of psycopg don't export dictfetch functions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-01 17:54:35 +00:00
Russell Keith-Magee f2582eb972 Fixes #2333 -- Added test fixtures framework.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4659 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-01 13:11:08 +00:00
Jacob Kaplan-Moss 4477f50f0b Added a "depth" argument to select_related() to control how many "levels" of relations select_related() is willing to follow (refs #3275).
Also added unit tests for select_related().

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4645 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-28 15:24:05 +00:00
Jacob Kaplan-Moss 9da791aa6b Fixed #3581, a small typo in OneToOneField.formfield(). Thanks, Andrew Sutherland.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4611 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 17:38:55 +00:00
Jacob Kaplan-Moss 51f39d59bd Fixed #3390: the serializer can now contain forward references. Thanks, Russ.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4610 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 17:33:27 +00:00
Jacob Kaplan-Moss a30e3fca48 Objects with FileFields no longer get save() called multiple times from the AutomaticManipulator! This fixes #639, #572, and likely others I don't know of.
This may be slightly backwards-incompatible: if you've been relying on the multiple-save behavior (why?), then you'll no longer see that happen.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 17:17:11 +00:00
Malcolm Tredinnick c27ba0b209 Fixed #2363 -- Fixed subclass checking in ModelBase to allow for mixin
superclasses. Thanks phil.h.smith@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 09:06:23 +00:00
Jacob Kaplan-Moss 670ea04e47 Cleaned up comments from [4597] to be a bit more clear.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4598 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 06:21:24 +00:00
Jacob Kaplan-Moss 90acc8ff7e Fixed #3438: improved the speed of Model.__init__ (about 1/3 faster, it appears). Thanks (a lot!) to Brian Harring.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4597 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 06:16:19 +00:00
Jacob Kaplan-Moss 6bd07383c0 Fixed #3172: Model.validate() no longer raises TypeErrors on empty Date*Fields. Thanks, floguy@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4592 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 05:07:12 +00:00
Jacob Kaplan-Moss dcdaa4ac3c Fixed #3459: Django no longer runs SET TIME ZONE for every query when using Postgres. This should result in a pretty noticible speedup for Postgres users, so many thanks to Jack Moffitt for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-25 16:18:46 +00:00
Jacob Kaplan-Moss f2aa1b93e0 Fixed silly typo in [4651].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4563 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-23 23:05:25 +00:00
Jacob Kaplan-Moss 16bd0aa991 Fixed #3541: queryset.count() now respects the queryset cache.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4561 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-23 20:58:28 +00:00
Adrian Holovaty abc949f584 Changed database PhoneNumberField to use USPhoneNumberField as its newforms form field (instead of IntegerField)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4556 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-21 05:59:46 +00:00
Adrian Holovaty e56934b9b9 Fixed #3257 -- Added newforms ModelChoiceField and ModelMultipleChoiceField, which are now used by form_for_model() and form_for_instance(). Thanks for the patch, Honza Kral, floguy@gmail.com and kilian.cavalotti
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4547 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-20 02:42:07 +00:00
Malcolm Tredinnick babc0793e3 Fixed behaviour of admin interface (and AddManipulator) when
min/max_num_in_admin is specified without num_in_admin. A consequence of
changes in [4500].


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4542 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-19 04:18:46 +00:00
Adrian Holovaty 4c4209b144 Changed __year lookup to use a BETWEEN SQL statement instead of comparing the result of EXTRACT(year). This should be more efficient.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-14 06:32:32 +00:00
Malcolm Tredinnick ff46f0fbcf Fixed #3394 -- Made min_num_in_admin be respected on new object creation. Patch
from torne-django@wolfpuppy.org.uk.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4500 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13 06:27:28 +00:00
Malcolm Tredinnick f41e2b7837 Updated [4497] to use something closer to the English language in the comment.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4498 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13 06:07:55 +00:00
Malcolm Tredinnick ba9649f966 Fixed #3377 -- Fixed subtle infinite recursion bug in LazyDate objects. Thanks
to brut.alll@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4497 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13 06:06:09 +00:00
Malcolm Tredinnick d123588184 #fixed #2256 -- Made count() interact with slicing on QuerySets. Patch from
SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-12 00:16:17 +00:00
Malcolm Tredinnick 6c4757729b Revert [4485] in order to fix accidental mod_python breakage. Refs #2920.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4486 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-11 23:50:35 +00:00
Russell Keith-Magee 0e924c70b1 Refs #2920 -- Replaced implicit uses of _() with explicit imports or calls to gettext(). At some point post 0.96, we need to remove the calls that put _ into the builtins.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4485 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-11 06:20:52 +00:00
Adrian Holovaty 007f17d63e Fixed #3463 -- EmptyQuerySet's iterator() now returns a generator. Thanks, Gary Wilson
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4475 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-10 05:38:38 +00:00
Malcolm Tredinnick e57ce6b157 Fixed #2348 -- Improved error reporting when query filter arguments are
misspelt. Variation on a patch from Karen Tracey.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-10 03:39:56 +00:00
Russell Keith-Magee 4ccdf127d0 Fixes #3447, Refs #2160 -- Reverting change [4459] because it breaks admin. Apologies for the inconvenience, guys.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4463 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-07 22:56:53 +00:00
Russell Keith-Magee 795de3a67c Fixed #2160 -- Modified object save logic to check for ``pk is None``, rather than ``bool(pk) == False``. This allows primary keys to take a value of 0. Thanks for the report, fgutierrez@aureal.com.pe.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4459 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-04 00:54:30 +00:00
Adrian Holovaty d28a63cc00 Fixed #3389 -- Many-to-many sets can now be assigned with primary key values
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4448 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-29 16:09:25 +00:00
Adrian Holovaty 829e4c70f8 newforms: Changed database Field formfield() methods to pass help_text to the formfield help_text
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4442 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-28 22:36:02 +00:00
Russell Keith-Magee 54feaca70f Fixed #3098 -- Added db_table parameter to m2m fields, allowing the specification of a custom table name for the m2m table. Thanks, Wolfram Kriesing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4429 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-25 13:47:55 +00:00
Russell Keith-Magee 12ad69c0b4 Fixed #3215, #3081, #2749 -- Fixed problem with mistaken deletion of objects when a GenericRelation is involved. Thanks to Thomas Steinacher for helping to narrow down the problem (#3215), and Alex Dedul (#3081) for the starting point of a working patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4428 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-25 11:24:17 +00:00
Adrian Holovaty 13280259a8 Fixed #3283 -- Added support for empty QuerySets via none() method. Thanks for the patch, medhat
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-23 02:11:08 +00:00
Adrian Holovaty 2e042f33e3 Changed database Field formfield() methods to take arbitrary kwargs, which are passed directly into the given Field constructor
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-22 06:32:14 +00:00
Adrian Holovaty 963ccd7cb4 Fixed #3267 -- newforms: Changed database TextField to render as Textarea in form_for_model() forms. Thanks for the patch, Philipp Keller
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4305 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-10 23:34:37 +00:00
Jacob Kaplan-Moss f6390e8983 Fixed #1477: URLFields now accept a maxlength parameter. Thanks, Matt Croydon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-08 20:28:31 +00:00
Russell Keith-Magee ddb9b7d57a Fixed #2473 -- Added special case for '__in=[]' (empty set) queries, because 'WHERE attr IN ()' is invalid SQL on many backends. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4283 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-04 04:00:16 +00:00
Adrian Holovaty f21cbb40b2 Fixed #3151 -- Improved MySQL backend not to send 'SET NAMES utf8' before every query. Thanks for the patch, smurf@smurf.noris.de
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-30 07:21:01 +00:00
Adrian Holovaty b9fdf9abb8 newforms: Got form_for_instance() to select initial ManyToManyField values properly
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4261 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-30 00:12:02 +00:00
Adrian Holovaty d681b084c3 Fixed #3205 -- Fixed bug in custom postgresql executemany wrapper. Thanks for reporting, jeffreyz@broadpark.no
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4257 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-29 19:01:29 +00:00
Adrian Holovaty 34dce706ee Added value_from_object method to db Field class
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4252 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-28 02:27:14 +00:00
Adrian Holovaty f974b1bb5a Negligible style fix to db/models/fields/__init__.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4251 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-28 02:20:29 +00:00
Adrian Holovaty 71ce11f617 newforms: Implemented form_for_instance(). The resulting Form class does not yet have a method that saves the changes
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-28 01:16:29 +00:00
Adrian Holovaty 016d75cc7f newforms: Implemented formfield() for database OneToOneField class. Not sure about this one, but one-to-one fields are eventually going to be refactored so it's not a big deal if it doesn't work
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-27 05:27:47 +00:00
Adrian Holovaty 6a75c8a52e newforms: Implemented formfield() for database ForeignKey class and added unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4247 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-27 05:23:21 +00:00
Adrian Holovaty d853278253 newforms: Implemented formfield() for database ManyToManyField class and added unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4246 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-27 05:15:22 +00:00
Adrian Holovaty 252606c711 Fixed #3115 -- Changed postgresql backend to convert all Unicode strings to bytestrings according to DEFAULT_CHARSET. This is necessary because psycopg1 does not apply database quoting to Unicode strings
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-27 05:14:02 +00:00
Russell Keith-Magee 64a2718f6c Refactored workhorse methods on m2m descriptors. Modified _add to check for the type of incoming objects (to match existing _remove implementation), and modified _remove to use a single query rather than 1 per object (to match existing _add implementation).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4233 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-20 14:06:27 +00:00
Russell Keith-Magee e859f108f1 Fixed problem with assiging an empty list to m2m related descriptors, introduced in [4231].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-20 13:57:17 +00:00