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 56 attachment: patch.diff (1.3 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
Index: mptt/__init__.py
===================================================================
--- mptt/__init__.py (revisione 121)
+++ mptt/__init__.py (copia locale)
@@ -53,19 +53,9 @@
db_index=True, editable=False).contribute_to_class(model, attr)

# Add tree methods for model instances
- setattr(model, 'get_ancestors', models.get_ancestors)
- setattr(model, 'get_children', models.get_children)
- setattr(model, 'get_descendants', models.get_descendants)
- setattr(model, 'get_descendant_count', models.get_descendant_count)
- setattr(model, 'get_next_sibling', models.get_next_sibling)
- setattr(model, 'get_previous_sibling', models.get_previous_sibling)
- setattr(model, 'get_root', models.get_root)
- setattr(model, 'get_siblings', models.get_siblings)
- setattr(model, 'insert_at', models.insert_at)
- setattr(model, 'is_child_node', models.is_child_node)
- setattr(model, 'is_leaf_node', models.is_leaf_node)
- setattr(model, 'is_root_node', models.is_root_node)
- setattr(model, 'move_to', models.move_to)
+ for name, method in vars(models).items():
+ if not name.startswith('_'):
+ setattr(model, name, method)

# Add a custom tree manager
TreeManager(parent_attr, left_attr, right_attr, tree_id_attr,
Powered by Google Project Hosting