#26456: Document formfield_callback attribute in ModelForm
-------------------------------+--------------------
     Reporter:  vzima          |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.9
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 When creating a form from model, the most effective way for modification
 of several fields at once is `formfield_callback`. While it is documented
 argument of `modelform_factory` which is used for dynamically created
 forms, the attribute `formfield_callback` on statically defined
 `ModelForm` remains undocumented. There is growing evidence, that despite
 it isn't documented it is generally used or required, see #17924,
 http://stackoverflow.com/questions/660929/how-do-you-change-the-default-
 widget-for-all-django-date-fields-in-a-modelform,
 http://stackoverflow.com/questions/7342925/django-problem-inheriting-
 formfield-callback-in-modelforms

 I don't require any change of functionality, I just want the following two
 methods to create a model form to be equal:
 {{{
 #!python
 # This works, but it's hard to read on a module level.
 MyModelForm = modelform_factory(MyModel, formfield_callback=my_callback)

 # This does the same thing, but it's not documented.
 class MyModelForm(forms.ModelForm):
     formfield_callback = my_callback

     class Meta:
         model = MyModel
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26456>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.0b18844690067e7fc357d9009468b35a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to