I agree with Tim that this is a slippery slope.

Maybe that adding a ModelFormMixin.get_form_class_options() that returns a
{'fields': self.fields} dict by default and is passed to 
in get_form_class() would be a good compromise? 


Le mardi 4 décembre 2018 17:28:39 UTC-5, Tim Graham a écrit :
> What I meant is that modelform_factory() also has these parameters:
> localized_fields is a list of names of fields which should be localized.
> labels is a dictionary of model field names mapped to a label.
> help_texts is a dictionary of model field names mapped to a help text.
> error_messages is a dictionary of model field names mapped to a 
> dictionary of error messages.
> field_classes is a dictionary of model field names mapped to a form field 
> class. 
> If we accept the patch for widgets, then are we headed down the road of 
> adding support for the rest of those arguments? Customizing a form directly 
> rather than indirectly via the view seems like better design to me. It 
> doesn't require adding features to ModelFormMixin as they are added to 
> ModelForm.
> On Tuesday, December 4, 2018 at 4:57:40 PM UTC-5, Dan F wrote:
>> https://code.djangoproject.com/ticket/24589
>> This ticket has a patch to pass through the "widgets" argument for 
>> generic class-based views.
>> It was closed with "won't fix" with this comment: "*I don't think the 
>> possibility of saving a few lines of user code justifies the complexity of 
>> reimplementing the parameters to modelform_factory() as CBV parameters and 
>> methods.*"
>> I don't understand. The patch was quite small (doesn't seem complex), and 
>> it could give everyone the ability to overload widgets.
>> Aside from just saving lines of code, it also would act more as expected. 
>> I tried using "widgets" before seeing that it didn't work. Also, it would 
>> support not making a new form class where every field just has to be copied 
>> (useless boilerplate).
>> Can you accept the patch?

You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to