def get_fk_model(model, fieldname):
    """returns None if not foreignkey, otherswise the relevant model"""
    field_object, model, direct, m2m = model._meta.get_field_by_name(fieldname)
    if direct and field_object.get_internal_type() in [
        "ForeignKey",
        "OneToOneField",
        "ManyToManyField",
    ]:
        return field_object.rel.to
    return None