My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 59 attachment: django-mptt_i59_r159.patch (1.1 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Index: mptt/utils.py
===================================================================
--- mptt/utils.py (revision 121)
+++ mptt/utils.py (working copy)
@@ -61,11 +61,13 @@
"""
structure = {}
opts = None
+ min_level = 100500
for previous, current, next in previous_current_next(items):
if opts is None:
opts = current._meta

current_level = getattr(current, opts.level_attr)
+ min_level = min(min_level, current_level)
if previous:
structure['new_level'] = (getattr(previous,
opts.level_attr) < current_level)
@@ -92,7 +94,7 @@
opts.level_attr), -1)
else:
# All remaining levels need to be closed
- structure['closed_levels'] = range(current_level, -1, -1)
+ structure['closed_levels'] = range(current_level, min_level, -1)

# Return a deep copy of the structure dict so this function can
# be used in situations where the iterator is consumed

Powered by Google Project Hosting