Oh, I misunderstood, I thought you controlled both the models and forms but wanted to enforce consistency. If you don't control the models (like FlatPage), I presume you control the forms then?You can do it then with a custom ModelForm subclass that overrides some of the building behaviour.
You'd have to subclass ModelFormMetaclass but it seems doable to me - you can customize the form class after ModelFormMetaclass has built it, by replacing any form fields that have been built with the ones you like. On Thursday, December 22, 2016 at 3:27:31 PM UTC, is_null wrote: > > Thanks for your suggestion Adam ! However, I have a feeling that to apply > that technique on the flatpages use case we'd also have to: > > 4. Monkey patch django.contrib.models.FlatPage.content, > > 5. Override and deal with flatpages migrations from now on. > > The proposal removes the cost of steps 1., 3., 4. and 5 and cuts the cost > of step 2. replacing the change in multiple model files to a single change > at one place. > > I definitely agree that a signal would be a lot better than a callback > setting ;) > > ======= ERRATA > There was an error in my previous email, this was actually the second > feature of the list: > - allows to override default form fields or form field options without > touching their code. > Should have been: > - allows to override external app model default form fields or form field > options without touching their code. > > > -- 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/5d32a3fe-7d6a-4584-b4c5-7ee0ed57d3f0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.