django-polymorphic
django-polymorphic copied to clipboard
Override multiple fieldsets of base_fieldsets
I have a model with extra fields but I would like to show these extra fields inside already existing fieldsets from the form base class.
I was able to do it with something like
def merge_by_key(ts):
dic = {}
for i, j in ts:
dic.setdefault(i,{}).setdefault('fields', ())
dic[i]['fields'] += tuple(j['fields'])
return tuple((k, v) for k, v in dic.items())
I can only override one section here because it's based on the extra_fieldset_title
This doesn't control where the fields end up in the fieldsets.
If I use extra_fieldset_title with the same name, well I just get 2 fieldsets with the same names.
For a case like this, should I just fully override base_fieldsets for each subclasses? Which is kind of annoying.