<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
 """ Replicates the logic in ModelAdmin.forfield_for_foreignkey, replacing the widget with the patched one above, initialising it with the child admin site. """

        db = kwargs.get('using')
        if db_field.name in self.raw_id_fields:
            kwargs['widget'] = PolymorphicForeignKeyRawIdWidget(
                db_field.rel,
                admin_site=self._get_child_admin_site(db_field.rel),
                using=db
            )
            if 'queryset' not in kwargs:
                queryset = self.get_field_queryset(db, db_field, request)
                if queryset is not None:
                    kwargs['queryset'] = queryset
            return db_field.formfield(**kwargs)
        return super(PolymorphicAdminRawIdFix, self).formfield_for_foreignkey(
            db_field, request=request, **kwargs)