get content type in a more sane manner
This commit is contained in:
parent
003161a216
commit
c1956e7509
|
@ -206,11 +206,12 @@ class ItfModel(models.Model):
|
||||||
Get the insidepages.models.ModelExtra object associated with this model
|
Get the insidepages.models.ModelExtra object associated with this model
|
||||||
'''
|
'''
|
||||||
def get_modelextra(self):
|
def get_modelextra(self):
|
||||||
try:
|
ctype = get_content_type()
|
||||||
ctype = ContentType.objects.get(model=self.__class__._meta.module_name)
|
# try:
|
||||||
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 = ContentType.objects.get(model=self.__class__._meta.module_name)
|
||||||
ctype = get_real_ctype(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).
|
||||||
# modelextra = ModelExtra.objects.filter(model=ctype)[0]
|
# ctype = get_real_ctype(self.__class__._meta.module_name)
|
||||||
|
# # modelextra = ModelExtra.objects.filter(model=ctype)[0]
|
||||||
try:
|
try:
|
||||||
modelextra = ctype.modelextra_set.all()[0]
|
modelextra = ctype.modelextra_set.all()[0]
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user