def get_subclass_fields(self, request, obj=None):
        # Find out how many fields would really be on the form,
        # if it weren't restricted by declared fields.
        exclude = list(self.exclude or [])
        exclude.extend(self.get_readonly_fields(request, obj))

        # By not declaring the fields/form in the base class,
        # get_form() will populate the form with all available fields.
        form = self.get_form(request, obj, exclude=exclude)
        subclass_fields = list(six.iterkeys(form.base_fields)) + list(self.get_readonly_fields(request, obj))

        # Find which fields are not part of the common fields.
        for fieldset in self.base_fieldsets:
            for field in fieldset[1]['fields']:
                try:
                    subclass_fields.remove(field)
                except __HOLE__:
                    pass   # field not found in form, Django will raise exception later.
        return subclass_fields
dataset/ETHPy150Open chrisglass/django_polymorphic/polymorphic/admin.py/PolymorphicChildModelAdmin.get_subclass_fields