Commit Graph

249 Commits

Author SHA1 Message Date
Hiroki Kiyohara 181f492ad0 Fixed #27416 -- Prevented ModelFormSet from creating objects for invalid PKs in data. 2016-12-06 13:06:58 -05:00
Jon Dufresne 6abd6c598e Fixed #27563 -- Moved "apply limit_choices_to" code from BaseModelForm to fields_for_model(). 2016-12-02 08:40:24 -08:00
Tim Graham 3507d4e773 Fixed #27186 -- Fixed model form default fallback for MultiWidget, FileInput, SplitDateTimeWidget, SelectDateWidget, and SplitArrayWidget.
Thanks Matt Westcott for the review.
2016-09-22 12:20:58 -04:00
Claude Paroz 2ced2f785d Replaced smart_* by force_* calls whenever possible
The smart_* version should only be used when a lazy string should keep
its lazy status.
2016-09-03 13:46:41 +02:00
Alex Hill d9c083cfee Refs #27039 -- Fixed regression with field defaults in prefixed forms. 2016-09-01 09:13:21 -04:00
Tim Graham 4bc6b93994 Fixed #27039 -- Fixed empty data fallback to model field default in model forms. 2016-08-24 17:50:10 -04:00
Tim Graham 4e86168290 Fixed #26970 -- Fixed crash with disabled ModelMultipleChoiceField. 2016-07-30 13:31:48 -04:00
David Sanders 5ec64f96b2 Fixed #26734 -- Made iterator class configurable on ModelChoiceField. 2016-06-09 11:10:26 -04:00
Tim Graham 67d984413c Refs #24227 -- Removed ManyToManyField special casing in model_to_dict(). 2016-05-11 10:12:59 -04:00
David Sanders a5c8a6ce19 Fixed #21332, #26538 -- Fixed inconsistent and duplicate form fields on inline formsets. 2016-04-26 10:26:25 -04:00
Jon Dufresne ec6121693f Fixed #22383 -- Added support for HTML5 required attribute on required form fields. 2016-04-21 19:16:38 -04:00
Michal Petrucha c339a5a6f7 Refs #16508 -- Renamed the current "virtual" fields to "private".
The only reason why GenericForeignKey and GenericRelation are stored
separately inside _meta is that they need to be cloned for every model
subclass, but that's not true for any other virtual field. Actually,
it's only true for GenericRelation.
2016-04-13 10:10:53 -04:00
Tim Graham df8d8d4292 Fixed E128 flake8 warnings in django/. 2016-04-08 09:51:06 -04:00
Tim Graham 2cd2d18851 Fixed W503 flake8 warnings. 2016-04-04 17:14:26 -04:00
Simon Charette 1a403aa705 Fixed #25987 -- Made inline formset validation respect unique_together with an unsaved parent object.
Thanks Anton Kuzmichev for the report and Tim for the review.
2016-03-26 21:49:41 -04:00
Simon Charette 5974cbe32e Removed unnecessary type creation in modelforset_factory. 2016-03-25 12:50:35 -04:00
Claude Paroz 983c158da7 Refs #24227 -- Replaced M2M isinstance checks by field.many_to_many
Thanks Markus Holtermann, Collin Anderson and Tim Graham for the reviews.
2016-03-19 09:24:27 +01:00
Yoong Kang Lim d5f89ff6e8 Fixed #24974 -- Fixed inheritance of formfield_callback for modelform_factory forms. 2016-02-26 12:27:27 -05:00
Claude Paroz d43156e1e9 Fixed #26238 -- Raised explicit error for non-editable field in ModelForm
Thanks Luke Crouch for the report and Simon Charette for the review.
2016-02-21 00:24:20 +01:00
haxoza 375e1cfe2b Fixed #25349 -- Allowed a ModelForm to unset a fields with blank=True, required=False. 2016-02-19 14:18:53 -05:00
Marti Raudsepp 1155843a41 Fixed #25683 -- Allowed ModelChoiceField(queryset=...) to accept Managers.
This fixes a regression from refs #25496.
2015-11-09 12:42:36 -05:00
Tim Graham 6afa6818fc Fixed #25496 -- Made ModelChoiceField respect prefetch_related(). 2015-10-05 18:21:56 -04:00
Claude Paroz 65a1055a36 Fixed #25431 -- Readded inline foreign keys to modelformset instances
Too much field exclusions in form's construct_instance() in _post_clean()
could lead to some unexpected missing ForeignKey values.
Fixes a regression from 45e049937. Refs #13776.
2015-09-21 21:30:49 +02:00
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Keryn Knight 3c5862ccb0 Fixed #24706 -- Made ModelForm._post_clean() handle a ValidationError raised when constructing the model instance.
Thanks Loïc Bistuer for review and advice.
2015-09-07 14:36:39 -04:00
Tim Graham 8656cfc4e0 Removed forms.models.save_instance() function.
As of b11564fd36 it's no longer
used elsewhere in Django and it isn't a documented public API.

Thanks Simon Charette for review.
2015-08-07 08:18:09 -04:00
Tim Graham f2b665f886 Fixed #25241 -- Corrected ModelForm.save() error message when saving invalid form with UUIDField pk. 2015-08-07 07:44:59 -04:00
Simon Litchfield 0ffa3943fb Fixed #25097 -- Added BaseModelFormSet.delete_existing() hook. 2015-07-14 09:05:44 -04:00
Jason Hoos a50b66da30 Fixed #24958 -- Fixed inline forms using UUID-PK parents with auto-PK children. 2015-06-26 09:09:09 -04:00
Piotr Jakimiak 4157c502a5 Removed unnecessary arguments in .get method calls 2015-05-13 20:51:18 +02:00
Peter Schmidt 681df1aeaf Fixed #24771 -- Simplified ModelForm._post_clean()
This code added in 45e049937d
is no longer necessary to pass the model_formsets_regress tests
as of 5e2c4a4bd1.
2015-05-08 12:11:10 -04:00
Luis Del Giudice 69ddc1b3da Fixed #24693 -- Added label and label_lower property to Model._meta 2015-05-02 16:58:18 +02:00
Anssi Kääriäinen 8f30556329 Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field
attribute. This means that self == self.remote_field.remote_field.

In addition, made the Rel objects a bit more like Field objects. Still,
marked ManyToManyFields as null=True.
2015-03-25 08:16:12 -04:00
Stanislas Guerra 4c2f546b55 Fixed #24395 -- Ensured inline ModelsForms have an updated related instance. 2015-02-24 11:49:00 -05:00
Tim Graham 1306cd1e8a Fixed #24377 -- Fixed model inline formsets with primary key's that have defaults. 2015-02-23 08:44:27 -05:00
Loic Bistuer 00a889167f Fixed #24295 -- Allowed ModelForm meta to specify form field classes.
Thanks Carl Meyer and Markus Holtermann for the reviews.
2015-02-13 19:13:05 +07:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Adam Taylor 039465a6a7 Fixed typos in code comments. 2015-01-20 12:18:03 -05:00
Tim Graham 2b4ca2ec29 Removed unused imports. 2015-01-17 14:42:51 -05:00
Tim Graham 2788c46d46 Removed Multiple/ModelChoiceField cache_choices option; refs #22838. 2015-01-17 13:48:46 -05:00
Tim Graham baf2542c4f Fixed DoS possibility in ModelMultipleChoiceField.
This is a security fix. Disclosure following shortly.

Thanks Keryn Knight for the report and initial patch.
2015-01-13 13:03:06 -05:00
Josh Schneier 3844ccc958 Fixed #24138 -- Added modelform_factory to __all__. 2015-01-12 17:44:06 -05:00
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Anssi Kääriäinen f233bf47dd Fixed #21414 -- Removed RelatedObject and deprecated Field.related. 2014-12-23 10:54:25 -05:00
Jon Dufresne 4468c08d70 Fixed #23968 -- Replaced list comprehension with generators and dict comprehension 2014-12-08 07:58:23 -05:00
Simon Charette a7c3d0f288 Fixed typo in forms/models.py comment. 2014-11-21 15:59:09 -05:00
Baptiste Mispelon bfb11b9562 Fixed #23795 -- Fixed a regression in custom form fields
Custom form fields having a `queryset` attribute but no
`limit_choices_to` could no longer be used in ModelForms.

Refs #2445.

Thanks to artscoop for the report.
2014-11-12 22:38:18 +01:00
Thomas Chaumeny fa534b92dd Fixed #23623 -- Reduced memory consumption when generating ModelChoiceField choices 2014-10-10 09:50:02 -04:00
Petras Zdanavičius f7eee04ebe Fixed #23451 -- Fixed typo in inlineformset_factory() error message. 2014-09-08 17:22:23 -04:00
Tim Graham 1101467ce0 Limited lines to 119 characters in django/
refs #23395.
2014-09-05 09:22:16 -04:00