<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_apphook_field_names(model):
 """ Return all foreign key field names for a AppHookConfig based model """

    from .models import AppHookConfig  # avoid circular dependencies
    fields = []
    for field in model._meta.fields:
        if isinstance(field, ForeignKey) and issubclass(field.remote_field.model, AppHookConfig):
            fields.append(field)
    return [field.name for field in fields]