What I meant about increasing coupling is this question: do we want to go 
down the road of defining more and more form related things in models? Yes, 
there are already a few options that are primarily for model forms (e.g. 
editable and blank), but is it okay to add more or should we try to avoid 
that?

For example, there was also a similar proposal to allow specifying the form 
field when instantiating a model field [0].

selected = models.BooleanField(
    ...,
    field=forms.ChoiceField(empty_label=None, widget=forms.RadioSelect())
)


If we accept the formfield_defaults proposal, then I don't see a clear 
place to draw the line to reject this other proposal.

[0] https://code.djangoproject.com/ticket/22609

On Thursday, March 17, 2016 at 9:46:30 AM UTC-4, is_null wrote:
>
> On Thu, Mar 17, 2016 at 2:17 PM, Tim Graham <[email protected] 
> <javascript:>> wrote: 
> > It seems useful, but I'm not sure if it increases the coupling between 
> model 
> > and forms in an undesirable way? 
>
> The coupling is already there because model fields sit right 
> in-between the db and form fields, so I don't know if it would 
> actually /increase/ the coupling. 
>
> Another way is to extract out all form related methods from model 
> fields (value_from_object(), save_form_data(), formfield()) into a new 
> class. 
>
> Then instead of this model: 
>
> dbfield -> model field <- formfield 
>
> You'd have: 
>
> form field 
>             \ 
>            modelformfield 
>               | 
>            model field 
>            / 
> dbfield 
>
> modelformfield would have the formfield(), value_from_object(), and 
> save_form_data(). 
>
> Anyway, are you sure it's not another issue ? I mean, even if we 
> decide to move formfield(), shouldn't it have overridable defaults ? 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/774f2f61-c749-4f82-b1e0-7dcc615f32d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to