Skip to content
Browse files

new coolest template

  • Loading branch information...
1 parent 0d5ed74 commit f4f4be5d2b9036c1fe7c4ce140aca0fe8a836dd9 @peterbe committed Oct 20, 2011
Showing with 13 additions and 9 deletions.
  1. +5 −3 handlers.py
  2. +8 −6 templates/coolest.html
View
8 handlers.py
@@ -460,9 +460,11 @@ def get(self):
options = {}
user = self.get_current_user()
key = 'ratios'
- ratios = self.redis.zrange(key, 0, -1, withscores=True)
- ratios.reverse()
- options['ratios'] = ratios
+
+ #ratios = self.redis.zrange(key, 0, -1, withscores=True)
+ #ratios.reverse()
+
+ options['ratios'] = self.db.Tweeter.find().sort('ratio', -1)
options['user'] = user
options['page_title'] = \
"Coolest in the world! ...on Twitter ...using this site"
View
14 templates/coolest.html
@@ -10,21 +10,23 @@
<h1>{{ page_title }}</h1>
<table>
- {% for i, (username, ratio) in enumerate(ratios) %}
+ {% for i, tweeter in enumerate(ratios) %}
<tr>
- <td>{{ i + 1 }}</td>
+ <td>{{ i + 1 }}.</td>
{% if user %}
<td>
- {% if username == user %}
+ {% if tweeter['username'] == user %}
{{ username }} &larr; me me me!
{% else %}
- <a href="/following/{{ username }}">{{ username }}</a>
+ <a href="/following/{{ tweeter['username'] }}">{{ tweeter['username'] }}</a>
{% end %}
</td>
{% else %}
- <td>{{ username }}</td>
+ <td><a href="https://twitter.com/#!/{{ tweeter['username'] }}"
+ title="{{ tweeter['name'] }} (following {{ tweeter['following'] }}, followed by {{ tweeter['followers'] }})"
+ >{{ tweeter['username'] }}</a></td>
{% end %}
- <td>{{ '%.1f' % ratio }}</td>
+ <td>{{ '%.1f' % tweeter['ratio'] }}</td>
</tr>
{% end %}
</table>

0 comments on commit f4f4be5

Please sign in to comment.
Something went wrong with that request. Please try again.