I've thought a bit more about this, and have had three ideas: 1. The signal idea doesn't seem likely to work in all cases due to import order considerations. Forms can easily be imported during Django startup whilst models, views, or urls, are imported, before AppConfig.ready() is fired, which is the recommended point to register signals (docs <https://docs.djangoproject.com/en/1.10/topics/signals/#django.dispatch.receiver>). It would be surprising if this one particular signal needed registering at some other point in time to work. Django currently has one signal which has this property, class_prepared <https://docs.djangoproject.com/en/1.10/ref/signals/#class-prepared> , but it's also noted as not generally being used outside of Django's internals.
2. It is probably possible to use class_prepared at current to replace the model fields on third party models with subclasses that define formfield() to point at custom form fields. 3. It's definitely possible right now to modify form classes in existing apps by modifying the fields on them after their construction with something similar to the metaclass suggestion, like: from otherapp.forms import FooForm # We need to enforce our widgets on that form FooForm.base_fields['html'] = fixup_field(FooForm.base_fields['html']) On 23 December 2016 at 16:14, James Pic <james...@gmail.com> wrote: > Thanks for your reply Adam ! To make it general purpose, perhaps we could > make such a patch in Django and replace should_fixup by a signal ? > > -- > 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/CALC3Kad0Y9ibX2Z9%2Bpj9mWCbc% > 2B63zEBqAGC8K1eD47mgMKe5Vg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-developers/CALC3Kad0Y9ibX2Z9%2Bpj9mWCbc%2B63zEBqAGC8K1eD47mgMKe5Vg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Adam -- 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/CAMyDDM1x_i8OBDXpz5sy4Sd-tiASDrRpV%3DrSFzjnwh2st13Bbw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.