'Setup the attributes of a related field.'

def _setup_related_full(self, model):

    if isinstance(self.related, basestring):
        self.related = tuple(self.related.split('.'))
    target = model
    for name in self.related:
        field = target._fields[name]
        field.setup_full(target)
        target = target[name]
    self.related_field = field
    if (self.type != field.type):
        raise TypeError(('Type    of    related    field    %s    is    inconsistent    with    %s' % (self, field)))
    self.depends = ('.'.join(self.related),)
    self.compute = self._compute_related
    if (not (self.readonly or field.readonly)):
        self.inverse = self._inverse_related
    if field._description_searchable:
        self.search = self._search_related
    for (attr, prop) in self.related_attrs:
        if (not getattr(self, attr)):
            setattr(self, attr, getattr(field, prop))
    for (attr, value) in field._attrs.iteritems():
        if (attr not in self._attrs):
            setattr(self, attr, value)
    if ((not self.states) and self.inherited):
        self.states = field.states
    if (self.inherited and field.required):
        self.required = True
