# Path: appsearch/ormutils.py
# def resolve_orm_path(model, orm_path):
#     """
#     Follows the queryset-style query path of ``orm_path`` starting from ``model`` class.  If the
#     path ends up referring to a bad field name, ``django.db.models.fields.FieldDoesNotExist`` will
#     be raised.
# 
#     """
# 
#     bits = orm_path.split(LOOKUP_SEP)
#     endpoint_model = reduce(get_model_at_related_field, [model] + bits[:-1])
#     field = endpoint_model._meta.get_field(bits[-1])
#     return field


import logging
import sys
from collections import OrderedDict
from functools import reduce
from hashlib import sha1 as sha
from itertools import chain
from operator import attrgetter, itemgetter
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist
from django.db import OperationalError, ProgrammingError, models
from django.db.models.constants import LOOKUP_SEP
from django.forms.utils import pretty_name
from django.utils.text import capfirst
from .ormutils import resolve_orm_path
                extended_name, sub_field_list = list(field_name.items())[0]
                orm_path_bits = base_orm_path[:]
                if related_name:
                    orm_path_bits.append(related_name)
                sub_fields.extend(
                    self._get_field_info(
                        orm_path_bits, related_model, extended_name, sub_field_list
                    )
                )
            else:
                # Raw field name or 2-tuple

                field = None
                # Check for a 2-tuple of ("Friendly name", "field_name")
                if isinstance(field_name, (tuple, list)):
                    verbose_name, field_name = field_name
                else:
                    # Derive a verbose name.  If the field comes from a model other than the base
                    # model, prepend the relate model's own verbose name.
                    field = related_model._meta.get_field(field_name)

                    if related_name:
                        verbose_name_bits = [related_model._meta.verbose_name, field.verbose_name]
                    else:
                        verbose_name_bits = [field.verbose_name]
                    verbose_name = " ".join(map(pretty_name, verbose_name_bits))

                if not isinstance(field_name, (tuple, list)):
                    field_name = (field_name,)
                if field is None:

# Path: appsearch/ormutils.py
# def resolve_orm_path(model, orm_path):
#     """
#     Follows the queryset-style query path of ``orm_path`` starting from ``model`` class.  If the
#     path ends up referring to a bad field name, ``django.db.models.fields.FieldDoesNotExist`` will
#     be raised.
# 
#     """
# 
#     bits = orm_path.split(LOOKUP_SEP)
#     endpoint_model = reduce(get_model_at_related_field, [model] + bits[:-1])
#     field = endpoint_model._meta.get_field(bits[-1])
#     return field


# Path: appsearch/registry.py
import logging
import sys
from collections import OrderedDict
from functools import reduce
from hashlib import sha1 as sha
from itertools import chain
from operator import attrgetter, itemgetter
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist
from django.db import OperationalError, ProgrammingError, models
from django.db.models.constants import LOOKUP_SEP
from django.forms.utils import pretty_name
from django.utils.text import capfirst
from .ormutils import resolve_orm_path

                extended_name, sub_field_list = list(field_name.items())[0]
                orm_path_bits = base_orm_path[:]
                if related_name:
                    orm_path_bits.append(related_name)
                sub_fields.extend(
                    self._get_field_info(
                        orm_path_bits, related_model, extended_name, sub_field_list
                    )
                )
            else:
                # Raw field name or 2-tuple

                field = None
                # Check for a 2-tuple of ("Friendly name", "field_name")
                if isinstance(field_name, (tuple, list)):
                    verbose_name, field_name = field_name
                else:
                    # Derive a verbose name.  If the field comes from a model other than the base
                    # model, prepend the relate model's own verbose name.
                    field = related_model._meta.get_field(field_name)

                    if related_name:
                        verbose_name_bits = [related_model._meta.verbose_name, field.verbose_name]
                    else:
                        verbose_name_bits = [field.verbose_name]
                    verbose_name = " ".join(map(pretty_name, verbose_name_bits))

                if not isinstance(field_name, (tuple, list)):
                    field_name = (field_name,)
                if field is None:

                    field = resolve_orm_path(related_model, field_name[0])