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
评论列表
文章目录