[Django]-Django – overiding get_fieldset in ModelAdmin returns a field twice

14👍

The original fieldsets dict is a class-level attribute. By inserting your field, you’re modifying the class-level dictionary, which affects all instances derived from it.

You might want to do a deepcopy of the fieldset before inserting:

import copy
...
fieldsets = copy.deepcopy(super(FeatureAdmin, self).get_fieldsets(request, obj))

Leave a comment