summaryrefslogtreecommitdiff
path: root/django/forms/models.py
AgeCommit message (Collapse)Author
2010-05-04Fixed #12164 -- Removed the Python 2.3 compatibility imports and ↵Russell Keith-Magee
workarounds. Thanks to timo and claudep for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-27Fixed #12749 -- Corrected a problem with validation of inline primary keys. ↵Russell Keith-Magee
Thanks to Chris.Wesseling@cwi.nl for the report, and nessita for the test case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13034 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-27Fixed #13407 -- Corrected verbose names for autogenerated m2m models, and ↵Russell Keith-Magee
cleaned up the default form prefix when an autogenerated m2m through model is used in a formset. Thanks to carljm for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-31Restored pre-r10062 behavior allowing None from formfield_callback to ↵Brian Rosner
exclude itself from the form git-svn-id: http://code.djangoproject.com/svn/django/trunk@12891 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-27Fixed #13023 - Removed ambiguity with regard to the max_num option of ↵Jannis Leidel
formsets and as a result of admin inlines. Thanks to Gabriel Hurley for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12872 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-18Fixed #13138: Ensure required=False on a model form field overrides Karen Tracey
blank=False on the underlying model field during model form clean, in order to maintain backward compatibility. Thanks to saxon75 for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12802 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-16Fixed #12881: Corrected handling of inherited unique constraints. Thanks for ↵Karen Tracey
report fgaudin. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-08Fixed #11183 - BaseForm init leaves pointers pointing back to base_fieldsLuke Plant
Thanks to margieroginski for the report git-svn-id: http://code.djangoproject.com/svn/django/trunk@12733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-06Fixed #12960. The return value of ModelForm.clean() is now applied to the ↵Joseph Kocherhans
model. Thanks for the report, krejcik. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12690 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-25Fixed #12901. Again. Model validation will not be performed on excluded ↵Joseph Kocherhans
fields that were overridden in the form. Thanks, ammarr. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23Fixed #12420. Now that OneToOneField allows assignment of None, stop ↵Joseph Kocherhans
guarding against it in ModelForms. Thanks, andrewsk. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12545 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23Fixed #12285. ModelForm raises a more informative error if it doesn't have a ↵Joseph Kocherhans
model class defined. Thanks, tobias. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12526 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-22Fixed #12901. Exclude overridden form fields from model field validation. ↵Joseph Kocherhans
Thanks, Honza Král. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-10Fixed #12698. Model.clean() used with a ModelForm no longer causes a ↵Joseph Kocherhans
KeyError when raising a ValidationError. Note that previously it was possible to raise a ValidationError in the same place with a message_dict attribute. That behavior was a bug and will no longer have the same behavior. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12402 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-26Fixed #12508 - Added ability to dynamically add inlines in the admin app.Jannis Leidel
Refs #13. Also introduces an ``empty_form`` attribute on formsets to make it easier to implement dynamic forms. Many thanks to Zain Memon for the initial patch from his Summer of Code 2009 project, Stanislaus Madueke for his django-dynamic-formset app and all the other people helping out. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-21Fixed #12596. Calling super from a ModelForm's clean method is once again ↵Joseph Kocherhans
optional. Failing to call super only skips unique validation as documented. Thanks for the initial patch and tests, carljm. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12269 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-12Fixed #12510. Changed ModelChoiceField to stop using some of its ↵Joseph Kocherhans
superclasses implementation. This could cause more than one query when generating choices. Thanks, Petr Marhoun and Honza Kral. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12211 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-12Fixed #12512. Changed ModelForm to stop performing model validation on ↵Joseph Kocherhans
fields that are not part of the form. Thanks, Honza Kral and Ivan Sagalaev. This reverts some admin and test changes from [12098] and also fixes #12507, #12520, #12552 and #12553. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10Fixed #9223 -- Added support for declarative widgets to ModelForm. I declare ↵Adrian Holovaty
thanks to isagalaev. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12194 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05Merged soc2009/model-validation to trunk. Thanks, Honza!Joseph Kocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22Fixed #1142 -- Added multiple database support.Russell Keith-Magee
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project. Congratulations to Alex for a job well done. Big thanks also go to: * Justin Bronn for keeping GIS in line with the changes, * Karen Tracey and Jani Tiainen for their help testing Oracle support * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback. * Malcolm Treddinick for his guidance during the GSoC submission process. * Simon Willison for driving the original design process * Cal Henderson for complaining about ponies he wanted. ... and everyone else too numerous to mention that helped to bring this feature into fruition. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-16Fixed #10263 -- Added a queryset argument to BaseInlineFormSet, normalizing ↵Russell Keith-Magee
with BaseModelFormSet, and allowing for custom ordering/subsets in inlines. Thanks to Paulo Scardine for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11874 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-13Fixed #12215: Added len to ModelChoiceIterator. Thanks Alex and Tobias.Karen Tracey
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-30Fixed #11872 -- Instantiate the correct model in BaseInlineFormSet.__init__ ↵Brian Rosner
when instance is None. Thanks tobias. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11688 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-24Fixed #11402: added a `QuerySet.exists()` method. Thanks, Alex Gaynor.Jacob Kaplan-Moss
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11646 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-03Fixed #10922 -- Corrected handling of POST data to ensure that the right ↵Russell Keith-Magee
objects are updated on save when the ordering field is editable. Thanks to Alex Gaynor, Karen Tracy, and Will Hardy for their contributions to this patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11160 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-29Fixed a few Python 2.3 incompatibilities that were causing test failures.Gary Wilson Jr
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10863 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-19Fixed #11149 -- Don't call save_form_data on file-type fields multiple times ↵Karen Tracey
when saving a model form. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-15Fixed #11120 -- Corrected handling of inlines attached to inherited classes, ↵Russell Keith-Magee
broken by r10756. Thanks to George Song and Michael Strickland for the simultaneous reports. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10787 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-14Fixed #10992: fixed a bug saving inlines with custom primary key fields. ↵Jacob Kaplan-Moss
Thanks, Zain. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10777 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-13Fixed #10243, #11043 -- Corrected handling of formsets over a ForeignKey ↵Russell Keith-Magee
that uses to_field, and by extension, fixed the admin for handling fields of that type. Thanks to apollo13 for the initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-10Changed r10668 to not falsely error out when using generic inlines.Malcolm Tredinnick
The bug was picked up by the tests already, but only if run against a backend that supports referential integrity. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10732 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-10Fixed #10792 -- Ensured that ModelChoiceFields don't provide an empty option ↵Russell Keith-Magee
when the underlying field has blank=False and there is a default value available. Thanks to carljm for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10729 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-08Fixed #10750: respect comment=False in inline formsets. Thanks, Koen Biermans.Jacob Kaplan-Moss
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10706 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-07Fixed #9493 -- Corrected error handling of formsets that violate unique ↵Russell Keith-Magee
constraints across the component forms. Thanks to Alex Gaynor for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-07Fixed #10893 -- Corrected a problem with using list_editable in the admin ↵Russell Keith-Magee
when the model has a manual primary key. Thanks to Alex Gaynor for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-30Fixed #10134 -- Added unique_for_[date|day|month|year] validation to ↵Russell Keith-Magee
ModelForm handling. Thanks to Alex Gaynor for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10646 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-22Fixed #10163: add an artificial ordering to querysets used by formsets, thus ↵Jacob Kaplan-Moss
ensuring that POSTed data "lines up" correctly every time. Thanks to Karen Tracey for pointing in the right direction here. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10625 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-22Fixed #10208: `ModelAdmin` now respects the `exclude` and `field` atributes ↵Jacob Kaplan-Moss
of custom `ModelForm`s. Thanks, Alex Gaynor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10619 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-18Fixed #10799: fixed the use of list_editable with model inheritance and ↵Jacob Kaplan-Moss
custom one-to-one parent links. Thanks, Alex Gaynor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-18Fixed #10156: `ModelMultipleChoiceField.clean` now does a single query ↵Jacob Kaplan-Moss
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-16Fixed #10363 -- Modified ModelForm handling to ensure that excluded fields ↵Russell Keith-Magee
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-11Fixed #10645 -- Added some robustness around some admin and modelform params.Malcolm Tredinnick
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-10Fixed #10038: make `BaseModelFormSet.save_existing_objects` use ↵Jacob Kaplan-Moss
`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-02Fixed #9651: fixed save_as with inline forms. Thanks, kmike and Mnewman.Jacob Kaplan-Moss
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10353 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31Forms in model formsets and inline formsets can now be deleted even if they ↵Joseph Kocherhans
don't validate. Related to #9587. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10283 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31Fixed #9863. A ForeignKey with editable=False to the parent in an inline no ↵Joseph Kocherhans
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-30Fixed #8746: Check data in raw_id_fields more closely. Thanks, dgouldinJacob Kaplan-Moss
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10233 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30Fixed #9284. Fixed #8813. BaseModelFormSet now calls ModelForm.save().Joseph Kocherhans
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-17Fixed #10512 -- Corrected the handling of extra fields on a ModelForm. ↵Russell Keith-Magee
Thanks to Alex Gaynor for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10070 bcc190cf-cafb-0310-a4f2-bffc1f526a37