def resolve_field(model_field, lookup_expr):
 query = model_field.model._default_manager.all().query
 lhs = Expression(model_field)
 lookups = lookup_expr.split(LOOKUP_SEP)
 assert (len(lookups) > 0)
 try:
  while lookups:
   name = lookups[0]
   if (len(lookups) == 1):
    final_lookup = lhs.get_lookup(name)
    if (not final_lookup):
     lhs = query.try_transform(lhs, name, lookups)
     final_lookup = lhs.get_lookup('exact')
    return (lhs.output_field, final_lookup.lookup_name)
   lhs = query.try_transform(lhs, name, lookups)
   lookups = lookups[1:]
 except FieldError as e:
  six.raise_from(FieldLookupError(model_field, lookup_expr), e)

def resolve_field ( model_field , lookup_expr ) : query = model_field . model . _default_manager . all ( ) . query lhs = Expression ( model_field ) lookups = lookup_expr . split ( LOOKUP_SEP ) assert ( len ( lookups ) > 0 ) try : while lookups : name = lookups [ 0 ] if ( len ( lookups ) == 1 ) : final_lookup = lhs . get_lookup ( name ) if ( not final_lookup ) : lhs = query . try_transform ( lhs , name , lookups ) final_lookup = lhs . get_lookup ( 'exact' ) return ( lhs . output_field , final_lookup . lookup_name ) lhs = query . try_transform ( lhs , name , lookups ) lookups = lookups [ 1 : ] except FieldError as e : six . raise_from ( FieldLookupError ( model_field , lookup_expr ) , e )
resolves a lookup_expr into its final output field .