formfield_for_dbfield examples floating around out there do not work because a lot of them directly call `db_field.formfield(**kwargs)`.
Either remove that call and let the super call take care of it (such as below) or remove `request` from the kwargs by calling kwargs.pop(‘request’)
It turns out the super call now removes the request kwarg before moving further in processing, so if you manually call db_field.formfield(**kwargs) your code will have this extra keyword.
def formfield_for_dbfield(self, db_field, **kwargs): if db_field.attname == 'long_description': kwargs['widget'] = CLEditorWidget() return super(ProductAdmin, self).formfield_for_dbfield(db_field, **kwargs)
I believe this hook isn’t supposed to be used even, as it’s not really in the docs.
I use it because formfield_overrides is global and doesn’t have per-field granularity and formfield_for_FK/M2M only works for relationships.
If I’m missing a better hook, just let me know. I haven’t really dug around as this is perfectly acceptable.