From d7afdc59f5d3465d5d4efa19bde3a70c7eda3e0a Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 24 Oct 2011 16:37:01 +0100 Subject: [PATCH] urlize twitter feed --- itf/frontpage/views.py | 5 +++-- itf/templates/noel/index.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/itf/frontpage/views.py b/itf/frontpage/views.py index 4416273..13387a2 100755 --- a/itf/frontpage/views.py +++ b/itf/frontpage/views.py @@ -6,6 +6,7 @@ import twitter from django.template import RequestContext from django import forms from django.forms.widgets import Textarea +from django.utils.html import urlize class ContactForm(forms.Form): email = forms.EmailField() @@ -22,12 +23,12 @@ class ContactForm(forms.Form): def index(request): try: tApi = twitter.Api() - statuses = tApi.GetUserTimeline(TWITTER_ID) + statuses = tApi.GetUserTimeline(TWITTER_ID)[0:3] except: statuses = [] boxes = SliderBox.objects.all() return render_to_response("noel/index.html", RequestContext(request, { - 'tweets': statuses[0:5], + 'tweets': [urlize(s.text) for s in statuses], 'boxes': boxes })) diff --git a/itf/templates/noel/index.html b/itf/templates/noel/index.html index b979e09..ead1d08 100755 --- a/itf/templates/noel/index.html +++ b/itf/templates/noel/index.html @@ -40,7 +40,7 @@