From ab6b48c9d94ff9ecd0b96fbe2f126f1732d299d0 Mon Sep 17 00:00:00 2001 From: Justin Quick Date: Thu, 29 Apr 2010 11:28:59 -0400 Subject: [PATCH] safe mptt registration --- categories/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/categories/models.py b/categories/models.py index 372b760..bb928ae 100644 --- a/categories/models.py +++ b/categories/models.py @@ -54,7 +54,8 @@ class Category(models.Model): ancestors = self.get_ancestors() return ' > '.join([force_unicode(i.name) for i in ancestors]+[self.name,]) -mptt.register(Category, order_insertion_by=['name']) +try: mptt.register(Category, order_insertion_by=['name']) +except: pass if RELATION_MODELS: category_relation_limits = reduce(lambda x,y: x|y, RELATIONS)