hacky fix for search results error
This commit is contained in:
parent
35f512353b
commit
1c88510391
|
@ -145,7 +145,10 @@ class ItfModel(models.Model):
|
|||
#Get the ModuleTab object associated with this object.
|
||||
def get_tab(self):
|
||||
modelextra = self.get_modelextra()
|
||||
tab = ModuleTab.objects.filter(model=modelextra)[0]
|
||||
if modelextra:
|
||||
tab = ModuleTab.objects.filter(model=modelextra)[0]
|
||||
else:
|
||||
tab = ModuleTab.objects.all()[0] #FIXME!!!
|
||||
return tab
|
||||
|
||||
|
||||
|
@ -182,7 +185,10 @@ 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 = ctype.modelextra_set.all()[0]
|
||||
try:
|
||||
modelextra = ctype.modelextra_set.all()[0]
|
||||
except:
|
||||
modelextra = None
|
||||
return modelextra
|
||||
|
||||
'''
|
||||
|
|
|
@ -33,16 +33,17 @@
|
|||
<h2>YOUR RESULTS:</h2>
|
||||
<p>
|
||||
{% for result in page.object_list %}
|
||||
<a href="{{ result.object.get_absolute_url }}&search={{ query }}">{{ result.object.title }}</a>
|
||||
{{ result.text|truncatewords:60|markdown|safe }}
|
||||
|
||||
|
||||
<a href="{{ result.object.get_absolute_url }}&search={{ query }}">{{ result.object }}</a>
|
||||
{{ result.text|truncatewords:60|markdown|striptags }}
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
{% empty %}
|
||||
<p class="noResults">No results found.</p>
|
||||
{% endfor %}
|
||||
|
||||
{% else %}
|
||||
{# Show some example queries to run, maybe query syntax, something else? #}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user