From a240fef9502d305f8364811e5205f9dd6ae19d25 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Fri, 10 Dec 2010 06:53:50 -0500 Subject: [PATCH] Added a Meta class for proper plural naming --- categories/models.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/categories/models.py b/categories/models.py index 56904ff..9ed278a 100644 --- a/categories/models.py +++ b/categories/models.py @@ -38,19 +38,23 @@ class Category(MPTTModel): default="", help_text="(Advanced) Any additional HTML to be placed verbatim in the <head>") - def get_absolute_url(self): """Return a path""" prefix = reverse('categories_tree_list') ancestors = list(self.get_ancestors()) + [self,] return prefix + '/'.join([force_unicode(i.slug) for i in ancestors]) + '/' - + + class Meta: + verbose_name_plural = 'categories' + unique_together = ('parent', 'name') + ordering = ('tree_id', 'lft') + class MPTTMeta: verbose_name_plural = 'categories' unique_together = ('parent', 'name') ordering = ('tree_id', 'lft') order_insertion_by = 'name' - + def __unicode__(self): ancestors = self.get_ancestors() return ' > '.join([force_unicode(i.name) for i in ancestors]+[self.name,])