I am trying to write a facebook application where a user can see the history of his friends. Everything seems to be working fine until I try to save status information in my DB. here is the code:
class UserStatus(models.Model):
facebookid = models.IntegerField()
time = models.IntegerField()
status_msg = models.CharField(max_length = 2000)
@facebook.require_login()
def canvas(request):
user, created = FacebookUser.objects.get_or_create(id = request.facebook.uid)
user_lastname = request.facebook.users.getInfo([request.facebook.uid], ['last_name'])[0]['last_name']
query = "SELECT time,message FROM status WHERE uid=%s" % request.facebook.uid
result = request.facebook.fql.query(query)
So, the result will give me all the status information. so my problem is that it gives an error when I try to save it.
userstatus = UserStatus()
for item in result:
userstatus.facebookid = request.facebook.uid
userstatus.time = item.time
userstatus.msg = item.message
userstatus.save()
error: Errors while loading the page from the application
Received HTTP 500 Error Code on Boot
So how can I fix this.
thanks.
source
share