safe mptt registration

This commit is contained in:
Justin Quick 2010-04-29 11:28:59 -04:00
parent 10177e3d2e
commit ab6b48c9d9

View file

@ -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)