

def get_profile_user_fieldname(profile_model=None, user_model=None):
    '\n    Returns the name of the first field on the profile model that\n    points to the ``auth.User`` model.\n    '
    Profile = (profile_model or get_profile_model())
    User = (user_model or get_user_model())
    for field in Profile._meta.fields:
        if (field.rel and (field.rel.to == User)):
            return field.name
    raise ImproperlyConfigured(('Value for AUTH_PROFILE_MODULE does not contain a ForeignKey field for auth.User: %s' % Profile.__name__))

dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/accounts/__init__.py get_profile_user_fieldname/original