operations.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:django-tree 作者: BertrandBordage 项目源码 文件源码
def __init__(self, model_lookup, path_field='path', parent_field='parent',
                 order_by=None, max_siblings=DEFAULT_MAX_SIBLINGS):
        self.model_lookup = model_lookup
        self.path_field = path_field
        self.parent_field = parent_field
        if path_field in order_by:
            raise ImproperlyConfigured(
                'Cannot use `%s` in `CreateTreeTrigger.order_by`.'
                % path_field)
        self.order_by = () if order_by is None else tuple(order_by)
        if not (isinstance(max_siblings, int) and max_siblings > 0):
            raise ImproperlyConfigured(
                '`max_siblings` must be a positive integer, not %s.'
                % repr(max_siblings))
        self.max_siblings = max_siblings
        i = self.max_siblings
        n = 0
        while i > 1.0:
            i /= ALPHANUM_LEN
            n += 1
        self.label_size = n
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号