[Oi-commits] trunk - fix length presentation

Uğur Çetin oi-svn at pardus.org.tr
Sat Feb 27 17:40:07 EET 2010


Author: jnmbk
Date: Sat Feb 27 17:40:07 2010
New Revision: 3046

Modified:
   trunk/podcast/models.py
   trunk/templates/podcast/feed.html
   trunk/templates/podcast/main.html
Log:
fix length presentation

---
 podcast/models.py           |    6 ++++++
 templates/podcast/feed.html |    2 +-
 templates/podcast/main.html |    2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

Modified: trunk/podcast/models.py
=================================================================
--- trunk/podcast/models.py	(original)
+++ trunk/podcast/models.py	Sat Feb 27 17:40:07 2010
@@ -64,6 +64,12 @@
     def get_absolute_url(self):
         return "/podcast/bolum/%s/" % self.slug
 
+    def get_length(self):
+        return "%s:%s" % (
+            "0%d" % self.minutes if self.minutes<10 else str(self.minutes),
+            "0%d" % self.seconds if self.seconds<10 else str(self.seconds)
+        )
+
     class Meta:
         verbose_name = "Bölüm"
         verbose_name_plural = "Bölümler"

Modified: trunk/templates/podcast/feed.html
=================================================================
--- trunk/templates/podcast/feed.html	(original)
+++ trunk/templates/podcast/feed.html	Sat Feb 27 17:40:07 2010
@@ -32,7 +32,7 @@
         <pubDate>{{ episode.update|rfc822datetime }}</pubDate>
         <itunes:author>{% for author in episode.authors.all %}{% if forloop.last %}{{ author.name }}{% else %}{{ author.name }}, {% endif %}{% endfor %}</itunes:author>
         <itunes:summary>{{ episode.sum|striptags }}</itunes:summary>
-        <itunes:duration>00:{{ episode.minutes }}:{{ episode.seconds }}</itunes:duration>
+        <itunes:duration>00:{{ episode.get_length }}</itunes:duration>
         <itunes:keywords>{% for tag in episode.tags.all %}{% if forloop.last %}{{ tag }}{% else %}{{ tag }}, {% endif %}{% endfor %}</itunes:keywords>
         <itunes:explicit>no</itunes:explicit>
     </item>

Modified: trunk/templates/podcast/main.html
=================================================================
--- trunk/templates/podcast/main.html	(original)
+++ trunk/templates/podcast/main.html	Sat Feb 27 17:40:07 2010
@@ -16,7 +16,7 @@
                 <div class="summary">{{ last_episode.sum|safe }}<br />
                     {% with last_episode as episode %}{% include "podcast/audioplayer.html" %}{% endwith %}
                 </div>
-                <div class="info" style="margin-top:5px"><span class="bold">Uzunluk: {{ last_episode.minutes }}:{{ last_episode.seconds }}</span><br /><span class="bold">{{ last_episode.update|date:"d" }} {{ last_episode.update|date:"F"|slice:":3" }}</span> {{ last_episode.update|date:"Y" }} <span class="bold">/</span> <a href="{{ last_episode.topic.get_latest_post_url }}"><span class="bold">{{ last_episode.topic.posts|add:"-1" }}</span> Yorum</a></div>
+                <div class="info" style="margin-top:5px"><span class="bold">Uzunluk: {{ last_episode.get_length }}</span><br /><span class="bold">{{ last_episode.update|date:"d" }} {{ last_episode.update|date:"F"|slice:":3" }}</span> {{ last_episode.update|date:"Y" }} <span class="bold">/</span> <a href="{{ last_episode.topic.get_latest_post_url }}"><span class="bold">{{ last_episode.topic.posts|add:"-1" }}</span> Yorum</a></div>
             </div>
             <div style="clear:both;"></div>
         </div>


More information about the Oi-commits mailing list