當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。