Commit Graph

210 Commits

Author SHA1 Message Date
Jacob Kaplan-Moss 1e4ad6f118 Fixed #10002: inline file uploads now correctly display prior data. Thanks, dgouldin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10588 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-18 20:29:55 +00:00
Jacob Kaplan-Moss 002e3fd9e4 Fixed #9124: fixed `SelectDateWidget` with `required=False`. Thanks, Bernd Schlapsi.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10584 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-18 17:35:53 +00:00
Jacob Kaplan-Moss 41260fb931 Fixed #10156: `ModelMultipleChoiceField.clean` now does a single query instead of O(N). Thanks, Alex Gaynor. Also, I ported a few more doctests to unittests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10582 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-18 15:51:11 +00:00
Russell Keith-Magee 419ed44436 Fixed #10363 -- Modified ModelForm handling to ensure that excluded fields can't be saved onto the model. Thanks to jgoldberg for the report, an Alex Gaynor for the fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10575 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-16 14:26:08 +00:00
Russell Keith-Magee 6590061a00 Fixed #9948 -- Corrected URLField validation to match RFC1035 (URL analog of #9890). Thanks to kratorius for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10574 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-16 14:25:18 +00:00
Russell Keith-Magee 48b459a83e Fixed #9890 -- Modified the regex validation for email addresses to match RFC822/1035. Thanks to ozgur for the report, and kratorius for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-16 14:24:27 +00:00
Malcolm Tredinnick 3bd384aa62 Fixed #10645 -- Added some robustness around some admin and modelform params.
Fieldset dictionary names, search fields and unique_together attribute
names all have to be convertible to strings (that has always been true).
If somebody passes in a unicode object, Python barfs because Django uses
those values as keyword argument names and function calls require
parameter names to be str objects. We now convert thing to strs
automatically.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10510 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 07:41:59 +00:00
Jacob Kaplan-Moss 9e9a2b88e8 Fixed #10038: make `BaseModelFormSet.save_existing_objects` use `Form.has_changed()` instead of looking at `changed_data` directly. Thanks, karihre.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10495 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 18:42:24 +00:00
Jacob Kaplan-Moss 95f5e4a8da Fixed #10774: accessing form media types in templates (i.e. ``{{ form.media.js }}``) now works. Thanks, tarequeh and Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 17:07:25 +00:00
Jacob Kaplan-Moss a64a61bf4a Fixed #8422: FilePathField now respects required=False.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10447 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-08 18:53:55 +00:00
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
Brian Rosner d57d490b76 Fixed #7918 -- Allow the foreign key in an inline to be any where in the parent chain. Thanks sil for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8708 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 17:41:40 +00:00
Jacob Kaplan-Moss b99cc935eb Fixed #7753: clean `NullBooleanField` correctly when using `HiddenInput`. Thanks to julien and ElliottM.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 15:06:18 +00:00
Brian Rosner d441a758de Corrected a couple of typos in docstrings of methods in BaseFormSet.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8630 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-27 15:39:00 +00:00
Malcolm Tredinnick 7e9a22aae7 Fixed #7289 -- Made ModelForms behave like Forms in the sense that Field
objects don't appear as attributes on the final form instance. They continue to
appear as elements of the form_instance.fields mapping.

If you were relying on ModelForms having fields as attributes, then this will
be slightly backwards incompatible. However, normal template usage will see no
change at all.

Patch from Daniel Pope.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8618 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-27 08:05:59 +00:00
Gary Wilson Jr c2ba59fc1d Removed oldforms, validators, and related code:
* Removed `Manipulator`, `AutomaticManipulator`, and related classes.
 * Removed oldforms specific bits from model fields:
   * Removed `validator_list` and `core` arguments from constructors.
   * Removed the methods:
     * `get_manipulator_field_names`
     * `get_manipulator_field_objs`
     * `get_manipulator_fields`
     * `get_manipulator_new_data`
     * `prepare_field_objs_and_params`
     * `get_follow`
   * Renamed `flatten_data` method to `value_to_string` for better alignment with its use by the serialization framework, which was the only remaining code using `flatten_data`.
 * Removed oldforms methods from `django.db.models.Options` class: `get_followed_related_objects`, `get_data_holders`, `get_follow`, and `has_field_type`.
 * Removed oldforms-admin specific options from `django.db.models.fields.related` classes: `num_in_admin`, `min_num_in_admin`, `max_num_in_admin`, `num_extra_on_change`, and `edit_inline`.
 * Serialization framework
   * `Serializer.get_string_value` now calls the model fields' renamed `value_to_string` methods.
   * Removed a special-casing of `models.DateTimeField` in `core.serializers.base.Serializer.get_string_value` that's handled by `django.db.models.fields.DateTimeField.value_to_string`.
 * Removed `django.core.validators`:
   * Moved `ValidationError` exception to `django.core.exceptions`.
   * For the couple places that were using validators, brought over the necessary code to maintain the same functionality.
 * Introduced a SlugField form field for validation and to compliment the SlugField model field (refs #8040).
 * Removed an oldforms-style model creation hack (refs #2160).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8616 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-27 07:19:44 +00:00
Malcolm Tredinnick 1fc8f84f58 Fixed #8566 -- Allow safe-strings in the "attrs" parameter to form widgets.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26 21:32:17 +00:00
Jacob Kaplan-Moss 4df380ff01 Fixed #8543: added translation markings to can_delete and can_order form labels. Thanks, msaelices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8562 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 22:55:24 +00:00
Jacob Kaplan-Moss cbd574881c Updated `TimeInput` changes from [8491] to allow time widgets to be used with unicode values. Fixes #7499.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 19:09:44 +00:00
Brian Rosner 82a1d5471c Fixed #7888 -- Handle model inheritance with model formsets correctly. Thanks bpeschier for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 03:51:25 +00:00
Malcolm Tredinnick 6d6fb392b4 Fixed #7195 -- Fixed the validation of MultipleChoice fields so that they can
be populated from request.REQUEST. Based on a patch from Daniel Roseman.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8525 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 00:32:32 +00:00
Malcolm Tredinnick eaa64cd889 Small edit of [8491].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8492 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 17:36:42 +00:00
Malcolm Tredinnick 8a3ef1f8bc Fixed #7499 -- Trim microseconds off rendering of form.TimeFields by default so
that they validate. Previous code didn't work with microseconds anyway, so this
is backwards compatible. Thanks to kevin for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8491 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 17:33:09 +00:00
Malcolm Tredinnick 3dd69a965b Fixed #7244 -- Allow widget overriding in subclasses for ModelChoiceField,
ModelMultipleChoiceField and FilePathField. Patch from Sebastian Noack and
Colin Grady.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 17:26:00 +00:00
Gary Wilson Jr 727133109c Fixed #8290 -- Fixed DecimalField's cleaning of values with a large number of decimal places, based on patch from dgouldin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8391 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 20:09:47 +00:00
Gary Wilson Jr ef48a3e69c Fixed #7830 -- Removed all of the remaining, deprecated, non-oldforms features:
* Support for representing files as strings was removed. Use `django.core.files.base.ContentFile` instead.
 * Support for representing uploaded files as dictionaries was removed. Use `django.core.files.uploadedfile.SimpleUploadedFile` instead.
 * The `filename`, `file_name`, `file_size`, and `chuck` properties of `UploadedFile` were removed. Use the `name`, `name`, `size`, and `chunks` properties instead, respectively.
 * The `get_FIELD_filename`, `get_FIELD_url`, `get_FIELD_size`, and `save_FIELD_file` methods for Models with `FileField` fields were removed. Instead, use the `path`, `url`, and `size` attributes and `save` method on the field itself, respectively.
 * The `get_FIELD_width` and `get_FIELD_height` methods for Models with `ImageField` fields were removed. Use the `width` and `height` attributes on the field itself instead.
 * The dispatcher `connect`, `disconnect`, `send`, and `sendExact` functions were removed. Use the signal object's own `connect`, `disconnect`, `send`, and `send` methods instead, respectively.
 * The `form_for_model` and `form_for_instance` functions were removed. Use a `ModelForm` subclass instead.
 * Support for importing `django.newforms` was removed. Use `django.forms` instead.
 * Support for importing `django.utils.images` was removed. Use `django.core.files.images` instead.
 * Support for the `follow` argument in the `create_object` and `update_object` generic views was removed. Use the `django.forms` package and the new `form_class` argument instead.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8291 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-10 21:10:47 +00:00
Russell Keith-Magee 4ecc5f490a Fixed #8041 -- Modified media rendering to return safe strings. Thanks to Daniel Pope <dan@mauveinternet.co.uk> for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8285 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-10 12:29:47 +00:00
Brian Rosner c49eac7d4f Fixed #8069 -- Corrected the inconsistent case with BaseInlineFormset. It has been renamed to BaseInlineFormSet. Backward incompatible for anyone who used BaseInlineFormset directly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8243 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-08 20:27:48 +00:00
Brian Rosner af35fb1fbb Ensure that custom primary keys are always shown on a formset. Refs #7938. Thanks magneto for discovering this problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8179 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-01 20:35:40 +00:00
Luke Plant 8fe07d1e63 Fixed #8030 - use super() in BaseModelForm
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8169 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-01 14:44:38 +00:00
Russell Keith-Magee 83f0d54d41 Modified inline handling to allow for an inline formset to be displayed when the foreign key exists on a parent class.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8165 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-01 00:27:40 +00:00
Malcolm Tredinnick 74dde43989 The help_text attribute in forms can be a ugettext_lazy() object, so be careful
not to trigger translations at import time.

I checked other usages of help_text in form fields and model fields and there
is not similar usage in __init__() methods.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-30 05:50:24 +00:00
Malcolm Tredinnick 03373f1e24 Fixed #7345 -- In [8089], I'd forgotten that urlparse.urlsplit() didn't return
something with attributes until Python 2.5. Thanks, Honza Kral and apollo13.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8093 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-26 17:08:53 +00:00
Malcolm Tredinnick 108b604b51 Fixed #7345 -- When normalising the URLField form field, attach a trailing
slash when only a host (no path) is given. Thanks, jpwatts.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-26 05:18:39 +00:00
Brian Rosner 3912403550 Added the ability to customize the prefix value on an inline formset. Fixes #7899. AThanks for the tip Peter of the Norse.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8060 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-23 04:46:31 +00:00
Brian Rosner 9d8f41baac Made the semi-private _max_form_count live on the public API of formsets by renaming it to max_num. This also removes the ManagementForm use of MAX_COUNT since that usage should just be referenced to the formset's max_num property. Refs #7899. Thanks Peter of the Norse for straightening me out.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8058 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-23 04:28:52 +00:00
Adrian Holovaty 29f0e8182f Fixed #7847 -- Removed a whole bunch of unused imports from throughout the codebase. Thanks, julien
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-22 03:24:09 +00:00
Russell Keith-Magee 4016d5264a Fixed #7727 -- Improved the checks for import failure when using PIL. Under PyPy, you can import the PIL module, but when you try to use it, the underlying _imaging module will not be available. Thanks to Maciej Fijalkowski (fijal) for the report and suggested fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8016 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-21 11:52:11 +00:00
Russell Keith-Magee 649463dd34 Fixed #4412 -- Added support for optgroups, both in the model when defining choices, and in the form field and widgets when the optgroups are displayed. Thanks to Matt McClanahan <cardinal@dodds.net>, Tai Lee <real.human@mrmachine.net> and SmileyChris for their contributions at various stages in the life of this ticket.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 07:53:02 +00:00
Jacob Kaplan-Moss 46786b4193 Fixed #7741: django.newforms is now django.forms. This is obviously a backwards-incompatible change. There's a warning upon import of django.newforms itself, but deeper imports will raise errors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 01:22:26 +00:00
Adrian Holovaty f6fd5827aa Changed django.forms to remove duplicate code and import from django.oldforms instead
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4234 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-22 01:44:34 +00:00
Jacob Kaplan-Moss 644af2213d Fixed #2899: added defaults for data and error_dict params to FormWrapper. Thanks, john@sneeu.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-06 22:56:23 +00:00
Malcolm Tredinnick be053df693 Fixed #2300 -- Added required "value" attribute to CheckboxSelectMultipleField
form field. Converted the submitted data for the same field back into something
we can work with. Thanks, lerouxb@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-26 04:37:10 +00:00
Malcolm Tredinnick e0cec60a14 Fixed #2727 -- Fixed problem with serialising error messages from validation.
Thanks, Ivan Saglaev.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3816 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-24 12:16:15 +00:00
Malcolm Tredinnick 00734bca7e Fixed #2599 -- Fixed rendering problem in comma-separated integer fields.
Thanks, Christopher Lenz.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3804 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-23 12:11:37 +00:00
Malcolm Tredinnick 539438a231 Fixed #2579 -- Fixed a problem with empty raw_id_admin form fields. Thanks to
Brendan McAdams and zakj@nox.cx for some good diagnostic work on this one.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-23 12:06:38 +00:00
Malcolm Tredinnick 14be60c4cb Fixed #2760 -- Fixed validation of negative float amounts in forms. Thanks,
James Bennett and Eddy Mulyono.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3788 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-22 03:42:31 +00:00
Malcolm Tredinnick 8feee92045 Fixed #2685 -- Correctly process blank input for USStateField elements. Thanks,
dackze+django@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3785 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-22 03:10:49 +00:00
Malcolm Tredinnick c430eb8273 Fixed #2640 -- Allow is_required for CheckboxField classes (defaults to False,
which was the previous behaviour). Thanks, torbjornthorsen@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3780 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-22 01:49:11 +00:00
Malcolm Tredinnick 31d764cadf Fixed #2761 -- Apply escaping to values in form checkbox attributes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3775 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-21 13:35:34 +00:00
Jacob Kaplan-Moss a55fa029f7 Fixed #1767 -- boolean fields may now have validators! Thanks, Joseph.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3467 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-28 00:13:10 +00:00
Malcolm Tredinnick c2556874d4 Fixed #1980, #2155 -- made date, time and datetime html2python methods a bit
more consistent in their return values. All three now return None when the
passed in string cannot be converted to the required object (this is assumed
elsewhere).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3277 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-05 07:09:53 +00:00
Adrian Holovaty 496d651546 Fixed #2190 -- Now allowing NullBooleanField to be given None
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3161 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-20 03:06:14 +00:00
Malcolm Tredinnick 271083cf7c Fixed #1756 -- Permit selecting no file in a FilePathField with blank = True.
Thanks to Adam Endicott for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3146 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-19 12:30:43 +00:00
Adrian Holovaty 2abfd5dd58 Fixed #2109 -- Convert old-style classes to new-style classes throughout Django. Thanks, Nicola Larosa
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 05:00:13 +00:00
Adrian Holovaty a88e0ec5c6 Fixed #2116 -- Added ul_class parameter to CheckboxSelectMultipleField. Thanks, Jorge Gajon
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3110 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 04:08:17 +00:00
Luke Plant 9b86db9bf2 Eliminated lots of mutable default arguments (since they are bugs
waiting to happen and are memory leaks too).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3070 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-03 13:37:34 +00:00
Luke Plant dbcd2fe985 Fixed #2045 - TypeError thrown if a form does not have the correct enctype for uploading
files.  It throws a ValidationError now, as it should.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 20:47:34 +00:00
Adrian Holovaty 7098389fae Fixed #2020 -- <option> values are now escaped in SelectMultipleField
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3021 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-31 14:58:20 +00:00
Adrian Holovaty 0627ad320c Fixed #1477 -- Made maxlength overridablef for URLField formfield
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2874 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-09 16:04:03 +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