I am almost done implementing tweets on my site using a tutorial which
a found here:
http://www.omh.cc/blog/2008/aug/4/adding-your-twitter-status-django-site/

The problem is that i want to modify the date output when i retrieve
multiple tweets. The example above is written for retrieving only one
most recent tweet from twitter.

The context_preprocessor i have now is (mostly taken from the site
above):

import datetime
import time
from django.conf import settings
from django.core.cache import cache
import twitter

def latest_tweet( request ):
    tweet = cache.get( 'tweet' )

    if tweet:
        return {"tweet": tweet}

    tweet = twitter.Api().GetUserTimeline( settings.TWITTER_USER,
count=3 )
    tweet.date = datetime.datetime(*(time.strptime( tweet.created_at,
"%a %b %d %H:%M:%S +0000 %Y" )[0:6]))
    cache.set( 'tweet', tweet, settings.TWITTER_TIMEOUT )

    return {"tweet": tweet}

This results in the following error:
AttributeError: 'list' object has no attribute 'created_at'

The twitter api let me call a human readable date in the template
using relative_created_at. Unfortunately the output is in English.

Any idea how i get an easy readable date?

The output is now:
Fri Oct 30 10:18:53 +0000 2009

Or:
about 6 days ago
When i use relative_created_at

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to