当前位置: 首页>>代码示例>>Python>>正文


Python query_utils.PathInfo方法代码示例

本文整理汇总了Python中django.db.models.query_utils.PathInfo方法的典型用法代码示例。如果您正苦于以下问题:Python query_utils.PathInfo方法的具体用法?Python query_utils.PathInfo怎么用?Python query_utils.PathInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.db.models.query_utils的用法示例。


在下文中一共展示了query_utils.PathInfo方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_path_to_parent

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_path_to_parent(self, parent):
        """
        Return a list of PathInfos containing the path from the current
        model to the parent model, or an empty list if parent is not a
        parent of the current model.
        """
        if self.model is parent:
            return []
        # Skip the chain of proxy to the concrete proxied model.
        proxied_model = self.concrete_model
        path = []
        opts = self
        for int_model in self.get_base_chain(parent):
            if int_model is proxied_model:
                opts = int_model._meta
            else:
                final_field = opts.parents[int_model]
                targets = (final_field.remote_field.get_related_field(),)
                opts = int_model._meta
                path.append(PathInfo(final_field.model._meta, opts, targets, final_field, False, True))
        return path 
开发者ID:Yeah-Kun,项目名称:python,代码行数:23,代码来源:options.py

示例2: get_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_path_info(self):
        """
        Get path from this field to the related model.
        """
        opts = self.rel.to._meta
        from_opts = self.model._meta
        return [PathInfo(from_opts, opts, self.foreign_related_fields, self, False, True)] 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:9,代码来源:related.py

示例3: get_reverse_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_reverse_path_info(self):
        """
        Get path from the related model to this field's model.
        """
        opts = self.model._meta
        from_opts = self.rel.to._meta
        pathinfos = [PathInfo(from_opts, opts, (opts.pk,), self.rel, not self.unique, False)]
        return pathinfos 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:10,代码来源:related.py

示例4: get_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_path_info(self):
        opts = self.rel.to._meta
        target = opts.pk
        return [PathInfo(self.model._meta, opts, (target,), self.rel, True, False)] 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:6,代码来源:fields.py

示例5: get_reverse_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_reverse_path_info(self):
        opts = self.model._meta
        from_opts = self.rel.to._meta
        return [PathInfo(from_opts, opts, (opts.pk,), self, not self.unique, False)] 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:6,代码来源:fields.py

示例6: get_path_to_parent

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_path_to_parent(self, parent):
        """
        Return a list of PathInfos containing the path from the current
        model to the parent model, or an empty list if parent is not a
        parent of the current model.
        """
        if self.model is parent:
            return []
        # Skip the chain of proxy to the concrete proxied model.
        proxied_model = self.concrete_model
        path = []
        opts = self
        for int_model in self.get_base_chain(parent):
            if int_model is proxied_model:
                opts = int_model._meta
            else:
                final_field = opts.parents[int_model]
                targets = (final_field.remote_field.get_related_field(),)
                opts = int_model._meta
                path.append(PathInfo(
                    from_opts=final_field.model._meta,
                    to_opts=opts,
                    target_fields=targets,
                    join_field=final_field,
                    m2m=False,
                    direct=True,
                    filtered_relation=None,
                ))
        return path 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:31,代码来源:options.py

示例7: get_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_path_info(self, filtered_relation=None):
        """Get path from this field to the related model."""
        opts = self.remote_field.model._meta
        from_opts = self.model._meta
        return [PathInfo(
            from_opts=from_opts,
            to_opts=opts,
            target_fields=self.foreign_related_fields,
            join_field=self,
            m2m=False,
            direct=True,
            filtered_relation=filtered_relation,
        )] 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:15,代码来源:related.py

示例8: get_reverse_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_reverse_path_info(self, filtered_relation=None):
        """Get path from the related model to this field's model."""
        opts = self.model._meta
        from_opts = self.remote_field.model._meta
        return [PathInfo(
            from_opts=from_opts,
            to_opts=opts,
            target_fields=(opts.pk,),
            join_field=self.remote_field,
            m2m=not self.unique,
            direct=False,
            filtered_relation=filtered_relation,
        )] 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:15,代码来源:related.py

示例9: get_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_path_info(self):
        """
        Get path from this field to the related model.
        """
        opts = self.remote_field.model._meta
        from_opts = self.model._meta
        return [PathInfo(from_opts, opts, self.foreign_related_fields, self, False, True)] 
开发者ID:Yeah-Kun,项目名称:python,代码行数:9,代码来源:related.py

示例10: get_reverse_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_reverse_path_info(self):
        """
        Get path from the related model to this field's model.
        """
        opts = self.model._meta
        from_opts = self.remote_field.model._meta
        pathinfos = [PathInfo(from_opts, opts, (opts.pk,), self.remote_field, not self.unique, False)]
        return pathinfos 
开发者ID:Yeah-Kun,项目名称:python,代码行数:10,代码来源:related.py

示例11: get_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_path_info(self):
        opts = self.remote_field.model._meta
        target = opts.pk
        return [PathInfo(self.model._meta, opts, (target,), self.remote_field, True, False)] 
开发者ID:drexly,项目名称:openhgsenti,代码行数:6,代码来源:fields.py

示例12: get_reverse_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_reverse_path_info(self):
        opts = self.model._meta
        from_opts = self.remote_field.model._meta
        return [PathInfo(from_opts, opts, (opts.pk,), self, not self.unique, False)] 
开发者ID:drexly,项目名称:openhgsenti,代码行数:6,代码来源:fields.py

示例13: get_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_path_info(self, filtered_relation=None):
        to_opts = self.remote_field.model._meta
        from_opts = self.model._meta
        return [PathInfo(
            from_opts=from_opts,
            to_opts=to_opts,
            target_fields=(to_opts.pk,),
            join_field=self,
            m2m=False,
            direct=False,
            filtered_relation=filtered_relation,
        )] 
开发者ID:nesdis,项目名称:djongo,代码行数:14,代码来源:empty_join.py

示例14: get_reverse_path_info

# 需要导入模块: from django.db.models import query_utils [as 别名]
# 或者: from django.db.models.query_utils import PathInfo [as 别名]
def get_reverse_path_info(self, filtered_relation=None):
        to_opts = self.model._meta
        from_opts = self.remote_field.model._meta
        return [PathInfo(
            from_opts=from_opts,
            to_opts=to_opts,
            target_fields=(to_opts.pk,),
            join_field=self.remote_field,
            m2m=False,
            direct=False,
            filtered_relation=filtered_relation,
        )] 
开发者ID:nesdis,项目名称:djongo,代码行数:14,代码来源:empty_join.py


注:本文中的django.db.models.query_utils.PathInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。