(self, model)
return field
Return the django model field for model in context, following relations.
Return the django model field for model in context, following relations.
Return the django model field for model in context following relations .
def get_field(self, model):
        """
        Return the django model field for model in context, following relations.
        """
        if not hasattr(model, "_meta"):
            return

        field = None
        for bit in self.bits:
            try:
                field = model._meta.get_field(bit)
            except FieldDoesNotExist:
                break

            if hasattr(field, "remote_field"):
                rel = getattr(field, "remote_field", None)
                model = getattr(rel, "model", model)

        return field
def get_field ( self , model ) : if not hasattr ( model , "_meta" ) : return field = None for bit in self . bits : try : field = model . _meta . get_field ( bit ) except FieldDoesNotExist : break if hasattr ( field , "remote_field" ) : rel = getattr ( field , "remote_field" , None ) model = getattr ( rel , "model" , model ) return field