content types
This commit is contained in:
parent
442b6dadd6
commit
505656c3f3
|
@ -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.
|
#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):
|
def get_real_ctype(module_name):
|
||||||
for c in ContentType.objects.filter(model=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 c
|
||||||
return None
|
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).
|
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)
|
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]
|
tab = ModuleTab.objects.filter(model=modelextra)[0]
|
||||||
return tab
|
return tab
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user