Commit e97101bb authored by fred's avatar fred

don't allow focus on soundfiles without a type

parent 5253438b
......@@ -95,13 +95,13 @@ def set_focus_url(object):
@register.filter
def can_focus(object):
if isinstance(object, NewsItem):
return True
return bool(object.category and object.image)
elif isinstance(object, Emission):
return True
elif isinstance(object, Episode):
return True
elif isinstance(object, SoundFile):
return True
return bool(object.format)
return False
......
......@@ -52,7 +52,7 @@
{% endif %}
{% endblock %}
{% block manage-focus %}
{% if object|can_focus %}
{% if object|can_focus or object|has_focus %}
{% if perms.emissions.add_focus %}
{% if object|has_focus %}
<a class="icon-pushpin" href="{{ object|unset_focus_url }}">Retirer le focus</a>
......
......@@ -100,7 +100,9 @@ Tags :
{% if soundfile.has_focus %}
<a class="icon-pushpin" href="{{ soundfile|unset_focus_url }}">retirer</a>
{% else %}
<a class="icon-pushpin" href="{{ soundfile|set_focus_url }}">mettre</a>
{% if soundfile.format %}
<a class="icon-pushpin" href="{{ soundfile|set_focus_url }}">mettre</a>
{% endif %}
{% endif %}
</td>
{% endif %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment