From 505656c3f381d05bbbfaf99b50bde68f762eca8b Mon Sep 17 00:00:00 2001 From: Sanj Date: Sat, 10 Sep 2011 04:55:10 +0530 Subject: [PATCH] content types --- itf/app/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/itf/app/models.py b/itf/app/models.py index b6a82b4..fbad0ae 100644 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -18,7 +18,7 @@ def splitSearch(string): #i see the point of this function, but please clean it up: refer to 'except MultipleObjectsReturned' to see why this is here. def get_real_ctype(module_name): for c in ContentType.objects.filter(model=module_name): - if c.is_itf_model == True: + if c.model_class().is_itf_model == True: return c return None @@ -49,7 +49,8 @@ class ItfModel(models.Model): except:#FIXME: ideally catch only MultipleObjectsReturned (figure out where to import that from :/ ) #FUCKING way ugly hack to get clashing model ctype names with django internal models working (get_real_ctypes simply checks, if there are multiple content objects with the same 'module_name', which one is_itf_model, and returns that). ctype = get_real_ctype(self.__class__._meta.module_name) - modelextra = ModelExtra.objects.filter(model=ctype)[0] +# modelextra = ModelExtra.objects.filter(model=ctype)[0] + modelextra = ctype.modelextra_set.all()[0] tab = ModuleTab.objects.filter(model=modelextra)[0] return tab