def objects(self, column_name, parent=None):
        """
        Given a column name, return the list of objects.

        If a parent is given and there is a parent column, filter the list by
        that parent.

        """
        col = self._get_column_by_name(column_name)
        ret = col.objects()
        if parent is not None:
            try:
                parent_col = self.parent_columns[col.name]
            except KeyError:
                raise ValueError(
                    "Column {0} has no parent.".format(column_name))

            opts = col.model._meta

            attr = None
            for field in [
                    f for f in opts.fields if isinstance(f, models.ForeignKey)
                    ] + opts.many_to_many:
                if field.rel.to is parent_col.model:
                    attr = field.name
                    break

            if attr is None:
                try:
                    attr = [
                        r.get_accessor_name()
                        for r in opts.get_all_related_many_to_many_objects()
                        if r.model is parent_col.model
                        ][0]
                except __HOLE__:
                    raise ValueError(
                        "Cannot find relationship from {0} to {1}".format(
                            col.model, parent_col.model))

            ret = ret.filter(**{attr: parent})
        return ret
dataset/ETHPy150Open mozilla/moztrap/moztrap/view/lists/finder.py/Finder.objects