如何将所有ForeignKey和OneToOneField字段设置为raw_id_fields

For example I have this 3 fields as set_soal, soal and folder. I need to assign all of this fields into raw_id_fields into their admin.ModelAdmin without add manually per-single fields.

class DaftarSoal(TimeStampedModel):
    ....
    set_soal = ForeignKey(SetSoal, ...)
    soal = ForeignKey(Soal, ...)
    folder = ForeignKey(Folder, ...)

the basic way to enable raw fields inside the admin.ModelAdmin look like this;

@admin.register(DaftarSoal, site=admin_site)
class DaftarSoalAdmin(admin.ModelAdmin):
    raw_id_fields = ('set_soal', 'soal', 'folder')    # manually

screenshot 1

But, can I setup all that OneToOneField and ForeignKey fields automatically into raw_id_fields without add it manually? such as applying the class mixin, for example:

class CustomAdminMixin:
    raw_id_fields = ()

    def __init__(self):
        self.setup_raw_id_fields()

    def setup_raw_id_fields(self):
        # search all OneToOneField and ForeignKey fields.
        # and assign into variable `raw_id_fields` above.

并实施;

@admin.register(DaftarSoal, site=admin_site)
class DaftarSoalAdmin(CustomAdminMixin, admin.ModelAdmin):
    pass



@admin.register(AnotherModel, site=admin_site)
class AnotherModelAdmin(CustomAdminMixin, admin.ModelAdmin):
    pass