From c1956e750985a02f5518c8293f9c3017529d3442 Mon Sep 17 00:00:00 2001 From: Sanjay B Date: Sat, 28 Sep 2013 18:26:50 +0530 Subject: [PATCH] get content type in a more sane manner --- itf/app/models.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/itf/app/models.py b/itf/app/models.py index f1c544a..7ded294 100755 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -206,11 +206,12 @@ class ItfModel(models.Model): Get the insidepages.models.ModelExtra object associated with this model ''' def get_modelextra(self): - try: - ctype = ContentType.objects.get(model=self.__class__._meta.module_name) - 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] + ctype = get_content_type() +# try: +# ctype = ContentType.objects.get(model=self.__class__._meta.module_name) +# 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] try: modelextra = ctype.modelextra_set.all()[0] except: