pandora/pandora/user/tasks.py

23 lines
537 B
Python
Raw Normal View History

2012-02-13 05:50:54 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from celery.task import task
import models
2012-03-21 08:13:38 +00:00
@task(ignore_results=True, queue='default')
2012-02-13 05:50:54 +00:00
def parse_data(key):
session_data = models.SessionData.objects.get(session_key=key)
session_data.parse_data()
session_data.save()
2012-03-21 08:13:38 +00:00
@task(ignore_results=True, queue='default')
def update_numberoflists(username):
user = models.User.objects.get(username=username)
models.SessionData.objects.filter(
user=user
).update(
numberoflists=user.lists.count()
)