<img class="map-thumbnail" src="{% url telemeta-images "world2.png" %}" alt="{% trans "Open the geographic navigator" %}" style="width:398px" /></a>
</div>
+{% if sound_pub_item %}
<div id="module" class="module">
<h3><img src="{% url telemeta-images "module_playlist.png" %}" alt="playlist" style="vertical-align:middle" />
{% trans "Musical selection" %}</h3>
</li>
</ul>
</div>
+{% endif %}
{% include "telemeta/inc/module_revisions.html" %}
{{ page_content|render_flatpage }}
</div>
+{% if sound_pub_items %}
<div style="margin-top: 1ex;">
<h1><img src="{% url telemeta-images "playlist_title.png" %}" alt="playlists" style="vertical-align:middle" />
{% trans "Musical selection" %}</h1>
<table style="font-size: 90%"><tr>
-{% for item in sound_items %}
-<td width="390"><a href="{% url telemeta-item-detail item.public_id %}">{{ item }}</a>{% if item.alt_title %} ({{ item.alt_title }}){% endif %}<br /><span style="font-size: 90%">{{ item.location.fullnames|to_string }}</span><br />
+{% for item in sound_pub_items %}
+<td width="390"><a href="{% url telemeta-item-detail item.public_id %}">{{ item }}</a>{% if item.alt_title %} ({{ item.alt_title }}){% endif %}<br /><span style="font-size: 80%">{{ item.location.fullnames|to_string }}</span><br />
<iframe width='376' height='215' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='/items/{{item.public_id }}/player/362x130/'></iframe></td>
{% endfor %}
</tr>
</table>
</div>
+{% endif %}
</div>
{% endblock %}
"""Render the homepage"""
if not request.user.is_authenticated():
template = loader.get_template('telemeta/index.html')
- ids = [id for id in MediaItem.objects.all().values_list('id', flat=True).order_by('?')[0:3]]
- items = MediaItem.objects.enriched().filter(pk__in=ids)
-
+# ids = [id for id in MediaItem.objects.all().values_list('id', flat=True).order_by('?')[0:3]]
+# items = MediaItem.objects.enriched().filter(pk__in=ids)
+#
sound_items = MediaItem.objects.sound()
sound_pub_items = []
for item in sound_items:
str(item.recorded_to_date).split('-')[0]):
sound_pub_items.append(item)
- sound_pub_item = sound_pub_items[0]
random.shuffle(sound_pub_items)
- if len(sound_pub_items) >= 2:
- sound_pub_items = sound_pub_items[0:2]
-
+ if len(sound_pub_items) != 0:
+ sound_pub_item = sound_pub_items[0]
+ else:
+ sound_pub_item = None
+ if len(sound_pub_items) == 2:
+ sound_pub_items = sound_pub_items[1]
+ if len(sound_pub_items) > 2:
+ sound_pub_items = sound_pub_items[1:3]
+
revisions = get_revisions(4)
context = RequestContext(request, {
'page_content': pages.get_page_content(request, 'home', ignore_slash_issue=True),
- 'items': items, 'revisions': revisions, 'sound_items': sound_pub_items,
+ 'revisions': revisions, 'sound_pub_items': sound_pub_items,
'sound_pub_item': sound_pub_item })
return HttpResponse(template.render(context))
else: