Hi,

It's not clear to me whether or not this proposal considers the concerns 
from the last time you raised the idea some months ago. Perhaps you could 
summarize that discussion so we don't rehash it.

Thanks. 

https://groups.google.com/d/topic/django-developers/zG-JvS_opi4/discussion

On Thursday, December 22, 2016 at 3:47:18 AM UTC-5, is_null wrote:
>
> Hi all,
>
> I'm looking for a way to override the default form field widget for some 
> fields of some model classes, at the project level.
>
> Currently, we have to override all the model classes for that. That's 
> considerable as a hack, because we don't exactly want to "override the 
> default in every form class" but we want to "override the default".
>
> The reason I need this at the project level is that really it's that 
> unique combination in INSTALLED_APPS that provides whatever widget I'd like 
> to override the default widget with, and how my project forms will look 
> like.
>
> For example, I'd like to have a RadioSelect for all relations to Foo 
> model and a django-redactor for all text fields named "html", my logic 
> looks like:
>
>         if getattr(db_field, 'rel', None) and db_field.rel.to == Foo:
>             defaults['widget'] = forms.RadioSelect
>         if db_field.model == Bar and 'html' in db_field.name:
>             defaults['widget'] = redactor.RedactorWidget
>
> A simple possibility is to add a setting which value would be a dotted 
> path to a callback, and basically change Field.formfield() so that it 
> would use this callback if it's defined. Here's an example patch: https://
> github.com/django/django/pull/7723
>
> Thanks for your feedback.
>

-- 
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 
https://groups.google.com/d/msgid/django-developers/71325b52-ab53-4a5f-af4e-2a785f6e2490%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to