24 lines
543 B
Python
24 lines
543 B
Python
if __name__ == '__main__':
|
|
import django
|
|
from django.conf import settings
|
|
django.setup()
|
|
|
|
import time
|
|
from celery import app
|
|
from django_rq import job
|
|
from async_messages import message_user,messages
|
|
from rowers.models import Workout
|
|
from django.contrib.auth.models import User
|
|
|
|
@app.task
|
|
@job
|
|
def addcomment2(userid,id):
|
|
print 'aap'
|
|
time.sleep(5)
|
|
w = Workout.objects.get(id=id)
|
|
w.notes += '\n the task has run'
|
|
w.save()
|
|
u = User.objects.get(id=userid)
|
|
messages.info(u,' The task has run')
|
|
return 1
|