Work list: don't care about types of objects on other pages.
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Fri, 21 Feb 2014 10:49:48 +0000 (11:49 +0100)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Fri, 21 Feb 2014 10:49:48 +0000 (11:49 +0100)
apps/catalogue/templates/catalogue/work-list.html
apps/catalogue/templatetags/catalogue_tags.py

index 6c1a766..fa33557 100755 (executable)
@@ -6,11 +6,11 @@
 {% spaceless %}
 <ol class='work-list'>
 {% for item in object_list %}
-    <li class='{% class_name item %}-item'>
+    <li class='{{ item|class_name }}-item'>
         {% if item.short_html %}
             {{ item.short_html }}
 {# since we are using shor_html eerywhere, is it needed anymore? #}
-        {% elif item.object_type == "Picture"  %}
+        {% elif item|class_name == "Picture"  %}
             {% picture_short item %}
         {% else %}
             {% book_short item %}
index 6ff60a3..bbd9f07 100644 (file)
@@ -365,9 +365,6 @@ def book_mini(book, with_link=True):
 @register.inclusion_tag('catalogue/work-list.html', takes_context=True)
 def work_list(context, object_list):
     request = context.get('request')
-    for obj in object_list:
-        obj.object_type = type(obj).__name__
-
     return locals()
 
 
@@ -472,7 +469,7 @@ def related_tag_name(tag, lang=None):
     return _related_tag_name(tag, lang)
 
 
-@register.simple_tag
+@register.filter
 def class_name(obj):
     return obj.__class__.__name__