Commit Graph

274 Commits

Author SHA1 Message Date
Adrian Holovaty 8831f3ee2c Added unit test that confirms a bug in ValuesQuerySets that have extra(select) specified. If the select dictionary has several fields, Django assigns the wrong values to the select-field names
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5767 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-27 21:53:02 +00:00
Gary Wilson Jr cae92ae615 Fixed #4373 -- Modified the get_object_or_404/get_list_or_404 shortcuts to also accept `QuerySet`s. Thanks SuperJared.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5746 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-22 03:41:11 +00:00
Russell Keith-Magee f2303b6f7a Fixed #4402 -- Modified test client to allow multi-valued inputs on GET requests. Thanks for the suggestion, eddymul@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5741 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-21 05:17:20 +00:00
Russell Keith-Magee 9922a04bb6 Fixed #3782 -- Added support for the suite() method recommended by the Python unittest docs. Thanks for the suggestion, rene.puls@repro-mayr.de.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5729 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-20 13:57:49 +00:00
Malcolm Tredinnick f9d27b5d0b Fixed #4870 -- Removed unneeded import and fixed a docstring in an example.
Thanks, Collin Grady.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5697 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-14 14:50:35 +00:00
Russell Keith-Magee b8d0dc73c7 Fixed #4526 -- Modified the test Client login method to fail when a user is inactive. Thanks, marcin@elksoft.pl.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5677 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-12 15:26:37 +00:00
Malcolm Tredinnick 87d8976fae Fixed #4804 -- Fixed a problem when validating choice lists with non-ASCII
data. Thanks, django@vonposer.de.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5642 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-10 12:03:36 +00:00
Malcolm Tredinnick d0b627acc2 Added a test that shows the problem in #4470. This fails only for the mysql_old
backend. Refs #4470.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5617 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-05 10:27:22 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Malcolm Tredinnick 3a892122f2 Made the reg-exp lookup tests more robust. they now pass for all database
backends and are not dependent on locale sorting order.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-01 04:47:46 +00:00
Jacob Kaplan-Moss 24512a74be Fixed #1465: added support for regex lookups. Thanks, Tom Tobin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5555 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-27 18:58:10 +00:00
Russell Keith-Magee ea07351799 Fixed #3466 -- Fixed problem with specifyin a 'fields' argument to a JSON serializer. Also added documenation for the 'fields' argument.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5409 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-01 13:39:08 +00:00
Jacob Kaplan-Moss bf2e62aa3c Fixed #3050: you can now use extra(select=...) with values(). Thanks, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5385 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-31 02:22:41 +00:00
Malcolm Tredinnick 92c35a0617 Fixed #2365, #3324 -- Renamed FloatField to DecimalField and changed the code
to return Decimal instances in Python for this field. Backwards incompatible
change.

Added a real FloatField (stores floats in the database) and support for
FloatField and DecimalField in newforms (analogous to IntegerField).

Included decimal.py module (as django.utils._decimal) from Python 2.4. This is
license compatible with Django and included for Python 2.3 compatibility only.

Large portions of this work are based on patches from Andy Durdin and Jorge
Gajon.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@5302 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-21 01:29:58 +00:00
Malcolm Tredinnick b996e214c0 Changed the fix from [5231] so that the backwards-incompatibility is made more
obvious and everything still has nice names.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5237 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-14 16:24:51 +00:00
Russell Keith-Magee 6aa5091d58 Added docs for form_for_model and form_for_instance, and added a fields argument so it is easy to create forms from a subset of model fields.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5202 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-12 14:42:46 +00:00
Russell Keith-Magee 70902908c7 Improved error reporting for assertions where there are no form errors, or a non-existent field has been provided. Also created a test client regression test, to hold the tests validating the failure cases of the TestCase assertions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5181 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-10 13:46:15 +00:00
Russell Keith-Magee 5c68ab6e29 Added configurable arguments to assertRedirects and assertContains to allow for other response status codes. Thanks for the suggestion, Jiri Barton.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5179 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-10 11:27:59 +00:00
Russell Keith-Magee 469314e7bc Added redirection for email services during test conditions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5173 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-08 11:19:34 +00:00
Malcolm Tredinnick 1c53661bd1 Moved generic relations into django.contrib.contenttypes, since it depends on
that to work. Backwards incompatible change.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-08 10:59:35 +00:00
Russell Keith-Magee f073797f4c Added assertFormError, assertTemplateUsed and assertTemplateNotUsed for use during unit testing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5156 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-07 12:34:18 +00:00
Adrian Holovaty 1889db475d Fixed comma splice in error message introduced in [5133]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5154 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-06 04:12:08 +00:00
Russell Keith-Magee 36b164d838 Backwards incompatible change: Changed the way test.Client.login operates. Old implemenation was fragile, and tightly bound to forms. New implementation interfaces directly with the login system, is compatible with any authentication backend, and doesn't depend upon specific template inputs being available.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5152 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-05 15:16:15 +00:00
Russell Keith-Magee a0ef3ba2f7 Added a default test Client to TestCase, and added some assertions for some common testing patterns.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5150 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-05 03:03:33 +00:00
Malcolm Tredinnick d943f5ae92 Fixed #4130 -- Added more self-explanatory error message when a typo is made in
a queryset field argument.

We may need to fine-tune the error message based on experience down the line,
but this stands as an improvement on its own. Thanks, Ned Batchelder.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-01 03:21:54 +00:00
Malcolm Tredinnick d9cc22b3e3 Fixed #3268 -- Changed default model formfields to use a select widget when the
field has a choices attribute. Based on a patch from mrmachine.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-28 14:18:03 +00:00
Adrian Holovaty e34e433641 Fixed #3929 -- Newforms Textarea widget now always includes 'rows' and 'cols' attributes, even if you don't pass them in, for HTML correctness. Thanks, and welcome back, Luke Plant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4961 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-09 01:22:45 +00:00
Malcolm Tredinnick 1109e722aa Fixed #2363 -- Improved base class checking in ModelBase metaclass. Thanks to
combined work from phil.h.smith@gmail.com and Chris.Wesseling@cwi.nl.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4881 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-31 12:02:37 +00:00
Jacob Kaplan-Moss 609a42ee06 Removed formatting from the select_related test title.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-23 20:18:58 +00:00
Jacob Kaplan-Moss 189e7dd802 Renumbered all the doctest examples so that they are ordered correctly on the doc pages.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4796 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-23 20:17:04 +00:00
Russell Keith-Magee f157bcefca Fixes #3212 -- Added code to test client to allow posting of multi-form values (e.g., MultipleChoiceFields). Thanks, Ben Dean Kawamura.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4774 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-22 10:23:52 +00:00
Malcolm Tredinnick 9fb40185fe Fixed tests that broke after [4756].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4759 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-20 23:27:16 +00:00
Russell Keith-Magee e4e74f7e1d Modified expected output of one fixture doctest to make it non unix-specific.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4716 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-13 00:33:15 +00:00
Russell Keith-Magee 9afc51bbcb Modified the internal dumpdata implementation to return the dumped data, rather than just printing to screen.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-13 00:29:21 +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 2cd6db682f Fixed a few Python2.3-related bugs in the tests (see #3396). A few more left, though.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4614 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 18:50: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 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
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 ee96c7eb2d Fixed #3534 -- newforms ModelChoiceField and ModelMultipleChoiceField no longer cache choices. Instead, they calculate choices via a fresh database query each time the widget is rendered and clean() is called
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4552 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-21 05:14:28 +00:00
Adrian Holovaty bdfbcb2cd5 Fixed #3247 -- newforms form_for_model() and form_for_instance() no longer create form fields for database fields with editable=False. Thanks for the patch, mssnlayam@yahoo.com and Philipp Keller
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-20 02:59:16 +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
Russell Keith-Magee d6d51c9546 Fixed #3160 -- Added the ability to control the content type in a test client POST request. This is to allow easier testing of json-rpc/xml-rpc/soap etc interfaces. Thanks to Mikeal Rogers for the suggestion, and Ben <afternoon@uk2.net> for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4529 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-17 00:23:09 +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 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
Russell Keith-Magee f9cdde0cb4 Fixed #3162 -- Added coded to catch and rethrow exceptions that are thrown by the views visited by the test client. Thanks, Ben <afternoon@uk2.net>.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4482 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-11 00:23:31 +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 9ba27afce0 Added a ``session`` attribute to the test Client, to make it easier to test if session variables have been modified in a view. Also renamed Client.cookie to Client.cookies, to match documentation and common sense.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4464 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-09 13:47:36 +00:00
Jacob Kaplan-Moss 1e3d035fcc Fixed Python 2.4-ism in modeltests/test_client. Thanks for the find, Robert Myers.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4451 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-29 16:48:31 +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
Adrian Holovaty 83768bf067 Fixed #3263 -- newforms form_for_model() and form_for_instance() now handle foreign-key and many-to-many data properly. Thanks for the patch, Jeff Hilyard
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-28 04:56:54 +00:00
Russell Keith-Magee db8525cc01 Fixed a flaw in the serializers that prevented OneToOneFields being serialized as JSON objects.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4433 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-27 13:42:51 +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 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
Adrian Holovaty 78b89ff118 Fixed #3232 -- newforms: Added save_instance(), which saves a given bound form's clean_data into a given model instance with the same field names
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4300 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-09 05:49:47 +00:00
Adrian Holovaty d08112a6a7 newforms: Changed model auto-Form generation so that create() and apply_changes() are now both called save() -- for the purposes of simplicity
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4299 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-09 05:22:48 +00:00
Adrian Holovaty 0421b2597f Fixed #3252 -- Fixed bugs in model_forms unit tests, related to recent newforms clean_data change. Thanks for the patch, mir@noris.de
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4294 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-08 18:06:22 +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
Russell Keith-Magee e1c6e987d0 Fixed #2756 -- Modified the get_object_or_404/get_list_or_404 shortcuts to accept model managers as well as model classes. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4275 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-03 14:16:58 +00:00
Adrian Holovaty 5a01f848ca Updated docstring in model_forms unit test
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4263 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-30 06:14:39 +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 bcb7a31b2c newforms: Implemented apply_changes() method for form_for_instance Forms
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4253 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-28 02:34:53 +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 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
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
Russell Keith-Magee 3a54d0cd5b Fixed #3164 -- Added explicit ordering to basic model test, and revised results to suit the explicit order. Thanks to Matt Boersma for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4228 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-19 03:38:38 +00:00
Adrian Holovaty a0ef6f6915 newforms: Added optional 'form' parameter to form_for_model
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-17 05:12:53 +00:00
Adrian Holovaty 4f5170bffe newforms: The Form classes created by form_for_model() now have a create() method, which creates a model instance from the clean_data
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4216 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 22:33:24 +00:00
Adrian Holovaty 5cb093b033 newforms: Changed form_for_model() to ignore a field if its formfield() returns None, and changed AutoField.formfield() to return None
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4214 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 21:22:13 +00:00
Adrian Holovaty 35f7e33b4a Implemented formfield() for a bunch of database Field classes
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4211 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 18:32:42 +00:00
Adrian Holovaty 6001974e45 newforms: Added initial implementation of form_for_model and form_for_fields
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 05:46:11 +00:00
Jacob Kaplan-Moss d4d1a22730 Fixed #2575: ObjectPaginator now accepts a "orphans" option to prevent pages with only a few items. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4041 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-07 04:44:27 +00:00
Malcolm Tredinnick 4ed82677be Fixed #2783 -- Fixed one-to-one fields to work with any primary key data type
in the related model. Thanks, Joel Heenan.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3846 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-26 02:58:36 +00:00
Russell Keith-Magee 0c41869e6c Made ``pk`` a generic expansion for the primary key, rather than just an expansion for __id__exact.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-25 13:49:01 +00:00
Russell Keith-Magee 5a9839c547 Fixes #2653 -- Modified related field utility methods to return None as the related name for symmetrical m2m fields on self. Updated validators and unit tests to account for the new behavior.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3734 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-07 13:29:56 +00:00
Russell Keith-Magee 826b9ff5e5 Refs #2333 - Added model test for the test Client.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3708 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-02 09:34:40 +00:00
Adrian Holovaty fe5462e57a Fixed typo in docstring of get_latest model unit test
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3683 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-31 03:16:08 +00:00
Russell Keith-Magee 97b9ad73b4 Refs #2333 - Modified runtests script to use new testing framework. Migrated existing tests to use Django testing framework. All the 'othertests' have been migrated into 'regressiontests', and converted into doctests/unittests, as appropriate.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-27 13:59:47 +00:00
Adrian Holovaty 23964a7b9a Fixed #2458 -- DB API now properly escapes backslashes, so you don't have to double-escape them. Thanks, tom@eggdrop.ch
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3552 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-11 05:20:31 +00:00
Malcolm Tredinnick a6a402a7db Fixed #2512 -- Fixed SQL error when saving existing empty models.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-10 03:55:03 +00:00
Adrian Holovaty 79b7fc17a1 Small formatting change to m2m_and_m2o model unit test
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3321 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-11 03:20:11 +00:00
Russell Keith-Magee cd7b54aab0 Fixes #2271 -- Added code to imply !__exact on any query argument that doesn't finish with a known query term.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-01 03:14:33 +00:00
Russell Keith-Magee c81d69354a Fixed #2217 -- Allowed raw objects to be used in __exact and __in query terms. Existing use of primary keys in query terms is preserved.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3246 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-01 01:14:41 +00:00
Jacob Kaplan-Moss c9032ab07f Added a JSON serializer, a few more tests, and a couple more lines of docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3237 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-29 16:42:49 +00:00
Jacob Kaplan-Moss 4ea7a11659 Added initial cut at serialization framework, along with some basic tests and a stab at some docs. This is all a bit rough right now, so expect some bumps.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3225 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-28 16:00:37 +00:00
Malcolm Tredinnick 414bc24e81 Fixed #1754, #2211, #2192 -- allow date filtering comparisons to use strings as
well as date objects. Fixed a couple of admin crashes as well.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-28 11:37:17 +00:00
Jacob Kaplan-Moss 48562965b9 Added {{{Manager.create()}}} method to create and save an object in a single step.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-27 20:36:25 +00:00
Russell Keith-Magee 2adbe11678 Fixes #2216 -- Added extra tests for model validity, and cleaned up warning messages for existing tests. Models are now invalid if the query string required to access a field (or related object) would clash with the name of another field (or related object). Previous tests only checked the accessor names, not the query string.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3215 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-27 15:21:43 +00:00
Adrian Holovaty b93de6a2cb Fixed bad formatting in 'lookup' model tests from [3157]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3170 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-20 04:16:11 +00:00
Adrian Holovaty 15cbc67ea2 Fixed #2195 -- Fixed spelling error in generic_relations model test. Other errors were fixed earlier today. Thanks, Tom Tobin
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3160 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-20 03:03:43 +00:00
Malcolm Tredinnick a8a133cc6c Fixed #1857 -- Fixed get_previous_by_FIELD and get_next_by_FIELD to work
properly with keyword arguments. Patch from tom@jerakeen.org.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3157 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-20 02:17:14 +00:00
Adrian Holovaty ed6d7285dd Fixed some small typos in generic_relations model tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3156 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-19 20:19:01 +00:00
Malcolm Tredinnick 1fc3b3229a Fixed #1683 -- Permit initialising models using settable properties as well as
field names.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-19 02:34:32 +00:00
Jacob Kaplan-Moss bca5327b21 Added generic foreign key support to Django. Much thanks to Ian Holsman and
Luke Plant -- most of this code is theirs.  Documentation is to follow; for now
see the example/unit test.  Fixes #529.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3134 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-16 19:18:30 +00:00
Malcolm Tredinnick 28e643743f Fixed #2164 -- Create correct SQL when pk column name is not the same as the
attribute name. Thanks, Russell Cloran.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3130 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-15 11:28:28 +00:00
Malcolm Tredinnick 686c5a2f88 Fixed the empty model saving case so that it retrieves the primary key id. Also
updated the tests to test this case.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-12 12:49:14 +00:00
Malcolm Tredinnick 4fc6e51706 Tests to avoid regressions for ticket #2108. See also r3115.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 15:15:27 +00:00
Malcolm Tredinnick 89920e058f Fixed #2108 -- do not try to save an empty model.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3104 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 00:13:52 +00:00
Malcolm Tredinnick 58ab678d35 Fix test output as a result of the change in r3094.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3103 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-07 09:19:43 +00:00
Adrian Holovaty b3a6348bc2 Added Manager.get_or_create()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3092 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-07 00:09:29 +00:00
Adrian Holovaty a5b7c29816 Changed all model unit tests to use __str__() instead of __repr__(). Also slightly changed related-object DoesNotExist exception message to use repr instead of str
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3075 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-04 00:23:51 +00:00
Adrian Holovaty 55e453a09c Changed 'transactions' model unit test NOT to be executed for MySQL
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3074 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-03 23:45:49 +00:00
Adrian Holovaty 142e59b462 Fixed #2077 -- Renamed 'repr' model tests to 'str'
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3072 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-03 22:14:04 +00:00
Adrian Holovaty 8ac9bb7ddf Fixed unit-test output error in m2m_and_m2o unit tests, due to a change in the model's __repr__ earlier today
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3041 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 04:30:39 +00:00
Adrian Holovaty cb9cb2045b Fixed #720 -- Added first_on_page() and last_on_page() methods to ObjectPaginator. Thanks, m@bagai.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3040 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 04:29:39 +00:00
Adrian Holovaty 02fcfe6216 Cleaned up numbering with model unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-31 19:23:07 +00:00
Adrian Holovaty a846155118 Small formatting changes to model unit tests to make them look better in the model examples online
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3030 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-31 19:10:43 +00:00
Adrian Holovaty 3daae59aab Added blurbs to the model unit tests that didn't have them
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3028 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-31 18:45:17 +00:00
Luke Plant 60c3e55b1f Fixed bug with QuerySet.exclude() failing to do negations on Q objects, and
at the same time generalised exclude/QNot so that they work for 'external'
Q objects i.e. ones that simply have 'get_sql' defined.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@2997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 23:41:43 +00:00
Luke Plant 0c8ac0972c Made negative indexing on QuerySet instances raise an assertion error (previously
it just returned incorrect results).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@2992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 18:41:03 +00:00
Luke Plant a666b98783 Fixed bug with Meta.ordering being ignored when slicing a single item off a QuerySet. Thanks, Gábor Fawkes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-23 19:55:30 +00:00
Malcolm Tredinnick 1006d6eb06 Fixed #1530 -- make count() respect distinct() on QuerySets. Create some
tests for this as well. Thanks to Adam Endicott for the original patch on which
this is based.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@2902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-14 23:49:29 +00:00
Luke Plant c427479539 Updated tests in line with changed exception messages, fixing 2 failures.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2898 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-11 21:52:23 +00:00
Luke Plant 4116403a55 Updated 'or_lookup' tests to give example of more compact syntax, for the sake of autogenerated docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2897 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-11 21:51:24 +00:00
Adrian Holovaty 0727df90f0 Fixed #1781 -- Fixed unit tests to use new error message for DoesNotExist. Thanks, pb
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2858 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-06 18:36:32 +00:00
Luke Plant f57e34e990 Fixed #1579 - added support for 'Q' objects in limit_choices_to.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-06 00:26:24 +00:00
Adrian Holovaty 69d6bd7af3 Fixed #1745 -- Accessing many-to-many relationships without a PK value now throws an exception. Thanks, Luke
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2817 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 19:51:41 +00:00
Adrian Holovaty f69cf70ed8 MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 01:31:56 +00:00