Commit Graph

104 Commits

Author SHA1 Message Date
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