Commit 1247243c authored by Matthieu Gautier's avatar Matthieu Gautier

Merge branch 'radio_size_date' into 'master'

Radio size date

Closes #36

See merge request !28
parents 05e8ec74 6ab2dbf0
......@@ -35,3 +35,16 @@ class RadioShow(Document):
def get_absolute_url(self):
return reverse('radio_detail', kwargs={'pk': self.pk})
@property
def size(self):
_size = self.original.size
units = [(_("GiB"), 1024**3),
(_("MiB"), 1024**2),
(_("KiB"), 1024**1),
(_("B"), 1)]
for unity, divider in units:
if _size > divider:
return "{} {}".format(_size//divider, unity)
return "{} {}".format(_size, _("B"))
{% load ideascube_tags mediacenter_tags static %}
<a class="card"
href="{% if url %}{{ url }}{% else %}{{ document.get_absolute_url }}{% endif %}"
{% if document_insert %}onclick="ID.tinymce_insert_document({{ document_insert }})"{% endif %}
>
<h3><span class="theme discover">{{ document.slug }}</span> {{ document }}</br>
<small>{{ document.air_date }} • {{ document.size}}</small></h3>
{% if document.preview %}
<img src="{% media document 'preview' %}" title="{{ document.title }}" />
{% elif document.kind == document.IMAGE %}
<img src="{% media document 'original' %}" title="{{ document.title }}" />
{% else %}
<img src="{% static document|default_preview_url %}" title="{{ document.title }}" />
{% endif %}
</a>
......@@ -25,7 +25,6 @@
{% form_field form.theme %}
{% form_field form.lang %}
{% form_field form.air_date %}
{% form_field form.duration %}
{% form_field form.hidden %}
{% form_field form.kind %}
......
......@@ -20,7 +20,7 @@
<div class="pure-g document-list card-container">
{% for document in radioshow_list %}
<div class="pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3 pure-u-xl-1-4 pure-u">
{% include "mediacenter/document_card.html" %}
{% include "irfi/radioshow_card.html" %}
</div>
{% empty %}
<div class="pure-u-1">
......
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