urlize twitter feed
This commit is contained in:
parent
8a67c196d8
commit
d7afdc59f5
|
@ -6,6 +6,7 @@ import twitter
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.forms.widgets import Textarea
|
from django.forms.widgets import Textarea
|
||||||
|
from django.utils.html import urlize
|
||||||
|
|
||||||
class ContactForm(forms.Form):
|
class ContactForm(forms.Form):
|
||||||
email = forms.EmailField()
|
email = forms.EmailField()
|
||||||
|
@ -22,12 +23,12 @@ class ContactForm(forms.Form):
|
||||||
def index(request):
|
def index(request):
|
||||||
try:
|
try:
|
||||||
tApi = twitter.Api()
|
tApi = twitter.Api()
|
||||||
statuses = tApi.GetUserTimeline(TWITTER_ID)
|
statuses = tApi.GetUserTimeline(TWITTER_ID)[0:3]
|
||||||
except:
|
except:
|
||||||
statuses = []
|
statuses = []
|
||||||
boxes = SliderBox.objects.all()
|
boxes = SliderBox.objects.all()
|
||||||
return render_to_response("noel/index.html", RequestContext(request, {
|
return render_to_response("noel/index.html", RequestContext(request, {
|
||||||
'tweets': statuses[0:5],
|
'tweets': [urlize(s.text) for s in statuses],
|
||||||
'boxes': boxes
|
'boxes': boxes
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<div id="contentTab">
|
<div id="contentTab">
|
||||||
<ul>
|
<ul>
|
||||||
{% for t in tweets %}
|
{% for t in tweets %}
|
||||||
<li>{{ t.text }}</li>
|
<li>{{ t|safe }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<!--
|
<!--
|
||||||
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user