Commit Graph

100 Commits

Author SHA1 Message Date
Jacob Kaplan-Moss 8f7aa84def Fixed #9651: fixed save_as with inline forms. Thanks, kmike and Mnewman.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10353 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-02 00:01:15 +00:00
Jacob Kaplan-Moss 6474092e9a Fixed a bug introduced by [10316].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10319 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 14:45:39 +00:00
Jacob Kaplan-Moss da0c6908e8 Fixed #9473: FormWizard now works with NullBooleanFields. As a bonus, we now have the beginnings of a test suite for FormWizard. Thanks, Keith Bussell.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10316 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 14:13:43 +00:00
Joseph Kocherhans 15becf23a9 Forms in model formsets and inline formsets can now be deleted even if they don't validate. Related to #9587.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10283 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 19:55:20 +00:00
Joseph Kocherhans 62353e8fe7 Fixed #9863. A ForeignKey with editable=False to the parent in an inline no longer raises an exception. Thanks to keithb for the test case and Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 00:03:34 +00:00
Jacob Kaplan-Moss 5c321780c2 Fixed #8746: Check data in raw_id_fields more closely. Thanks, dgouldin
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10233 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 23:00:36 +00:00
Joseph Kocherhans fea6c73538 Fixed #10149. FileFields in a form now validate max_length. Based on a patch by Massimo Scamarcia.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10227 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 22:52:16 +00:00
Joseph Kocherhans 08056572e8 Fixed #9587. Formset.is_valid() now returns True if an invalid form is marked for deletion. Thanks for the test and intial patch, kratorius.
Note that this leaves the form and formset errors alone. Those forms still have errors, it's just that it doesn't matter that they're invalid in the context of the formset and deletion.
Also fixed #9665 while I was in there. Thanks, mark_hildreth.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 19:36:19 +00:00
Joseph Kocherhans 9face54bb7 Fixed #9284. Fixed #8813. BaseModelFormSet now calls ModelForm.save().
This is backwards-incompatible if you were doing things to 'initial' in BaseModelFormSet.__init__, or if you relied on the internal _total_form_count or _initial_form_count attributes of BaseFormSet. Those attributes are now public methods.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10190 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 15:58:52 +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
Jacob Kaplan-Moss f66853bcca Fixed `BaseFormSet.is_multipart()` so that it doesn't bomb when called on an empty formset.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10073 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-17 19:23:23 +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
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
Karen Tracey 81ae2afdec Fixed 10075: Allowed saving of inline-edited models that use multi-table inheritance.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-03 14:02:09 +00:00
Karen Tracey 795c229ae9 Fixed #10069 -- Fixed the model form unique validation code to not proceed with using, for example, RelatedObjects returned by get_field_by_name as though they were model Fields.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9777 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-19 19:37:31 +00:00
Gary Wilson Jr f0d44e44bd Fixed #9882 -- Added `alters_data = True` to `BaseModelForm.save` method, thanks dc.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9678 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-23 05:50:51 +00:00
Karen Tracey ca33f07e2c Fixed #9865 -- Allow saving of new inline-edited objects with custom non-auto primary key fields that are not the foreign key to the parent object.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9664 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-21 04:56:32 +00:00
Malcolm Tredinnick d662ef5540 The first step in fixing a group of problems related to outputting a proper
"value" for a field that is a relation to another model.

This part adds the utility method on Model that should help in general.Also
cleans up the slightly ugly mess from r8957.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-08 08:15:37 +00:00
Adrian Holovaty 352efd1893 Edited docs/topics/forms/index.txt changes from [9569] and fixed a typo in the visible_fields() docstring
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9592 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-08 04:07:42 +00:00
Malcolm Tredinnick bfab9d62ee Added a way to iterate over hidden/visible fields in a form. Useful for manual
form layout.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9569 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-05 04:22:00 +00:00
Karen Tracey bca14cd3c8 Fixed #9076 -- Changed BaseInlineFormSet to not override BaseModelFormSet's get_queryset method. BaseInlineFormSet's method did not include a couple of fixes/enhancements that were made to the parent's method, resulting in excessive queries (some of which can return bad data due to #9006) for admin pages with inlines.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9440 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-14 15:37:59 +00:00
Karen Tracey d82aaef844 Fixed #7064: Made DemicmalField validation support max_digits equal to decimal_places.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9387 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-10 19:52:53 +00:00
Karen Tracey 8cdc53a265 Fixed #6035 -- Gave the SplitDateTimeField the proper default widget. Thanks dtulig.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9385 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-10 19:42:55 +00:00
Karen Tracey bcd63cbfb0 Fixed #6160, #9111 -- Consistently apply conditional_escape to form errors and labels when outputing them as HTML.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9365 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-06 19:49:24 +00:00
Karen Tracey 21fa517248 Fixed #9218 -- Simplified the fix from #9039 and added tests to ensure this case doesn't break again (and that the simplification didn't break anything).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9341 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-05 19:47:44 +00:00
Karen Tracey 1515b13d1a Fixed #9418 -- When saving a model form, defer saving of file-type fields until after other fields, so that callable upload_to methods can use data from the other fields. Thanks to Bernd Schlapsi for the report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9334 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-04 19:48:35 +00:00
Brian Rosner 83af0b8ff3 Fixed #9494 -- Ensure the foreign key in an inline formset is always present on the forms. Thanks Fugazi for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9326 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-01 22:25:41 +00:00
Brian Rosner 0ea15f5650 Fixed #8882 -- When a foreign key is among the unique_together fields in an inline formset properly handle it.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-31 22:07:05 +00:00
Brian Rosner 524a44e20b Fixed #9462 -- Set the instance in an inline formset correctly so that None does not get passed through to the queryset. Thanks tobias and copelco for the ticket.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9293 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-28 20:01:03 +00:00
Malcolm Tredinnick 92a6c14291 Fixed #9384 -- Fixed a couple of typos. Thanks, Thomas Güttler and romke.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9255 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-24 07:14:30 +00:00
Karen Tracey 49ef21d9ea Fixed #9039 -- Don't perform unique checks on NULL values, since NULL != NULL in SQL.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-21 14:04:24 +00:00
Malcolm Tredinnick 7e7a370e20 Fixed #9319 -- Fixed a crash when using the same model field in multiple
unique_together constraints.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9208 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-08 10:09:44 +00:00
Malcolm Tredinnick e1b7211083 Fixed #9294 -- Removed a (harmless) double conversion to unicode in one form
widget. Patch from nkilday.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-05 08:51:14 +00:00
Malcolm Tredinnick 6c7cf34d69 Fixed #9171 -- Fixed a few places where we were assuming lists instead of
generic sequences in ModelForm structures. Patch from mrmachine.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9086 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-27 05:57:10 +00:00
Malcolm Tredinnick 9931c9e132 Fixed #9125 -- When displaying errors for a form with only hidden fields, make sure the resulting XHTML is correct.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9067 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-18 07:16:08 +00:00
Malcolm Tredinnick 75528786a9 Fixed #8841 -- Fixed a case of ForeignKeys to models constructed with
inheritance.

This patch is uglier than it needs to be (see comment in patch) to ensure no
accidental bug is introduced just before 1.0. We'll clean it up later.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-03 22:45:33 +00:00
Malcolm Tredinnick 1794446b28 Fixed #8828 -- Trimmed some trailing whitespace that might have been causing a
problem for Google AppEngine.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8911 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-03 06:22:28 +00:00
Jacob Kaplan-Moss f6a3652eb2 Fixed #8788: fixed a few typoes in [8805]. Thanks, Matthew Flanagan and mir.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8872 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-02 19:33:56 +00:00
Jacob Kaplan-Moss 98e1cc92f4 Fixed #8795: unique_together validation no longer fails on model forms that exclude fields included in the check. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8854 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-02 14:20:11 +00:00
Brian Rosner ce47d4ab83 Fixed #8648 -- Admin no longer ignores to_field. Thanks for the help Karen Tracey and SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 22:43:38 +00:00
Malcolm Tredinnick dcb0e8f959 Fixup for Python 2.3.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 22:32:40 +00:00
Jacob Kaplan-Moss d86a702d37 Fixed #8777: use better capitalization in unique together error message. Thanks, Petr Marhoun.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8820 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 22:22:12 +00:00
Brian Rosner 2487e3ae37 Removed a conditional that slipped by that makes inline model formsets fail validation when re-submitted.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8817 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 21:33:15 +00:00
Brian Rosner 7c7ad041b3 Fixed #7975 -- Callable defaults in inline model formsets now work correctly. Based on patch from msaelices. Thanks for your hard work msaelices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8816 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 21:28:32 +00:00
Jacob Kaplan-Moss ea05e61b2b Fixed #8209: `ModelForm`s now validate unique constraints. Alex Gaynor did much of this work, and Brian Rosner helped as well.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8805 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 19:08:08 +00:00
Brian Rosner d511996901 Enforce max_num=1 on inline model formsets that have a unique foreign key to its parent. I snuck in a quick clean up to the inlineformset_factory as well.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8775 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 21:14:46 +00:00
Jacob Kaplan-Moss 4ae746b574 Added a `TypedChoiceField` which acts just like `ChoiceField`, except that it
returns a value coerced by some provided function. Refs #6967.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8771 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 20:10:50 +00:00
Malcolm Tredinnick 24bacb19de Fixed #5216 -- Fixed a case of a string not being a unicode string.
Thanks to Vadim Fint for the test case.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8761 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 11:39:06 +00:00
Brian Rosner 27f9b96fa0 Fixed handling of primary keys in model formsets. Model formsets should now work nicely with custom primary keys that are OneToOneField, ForeignKey and AutoField. Added tests to handle each of them.
Fixes #8241, #8694, #8695 and #8719.

Thanks Karen Tracey, jonloyens, sciyoshi, semenov and magneto for tracking down various parts of this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 09:49:55 +00:00