testing tasks and messages
This commit is contained in:
@@ -27,6 +27,7 @@ from django.conf import settings
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib import messages
|
||||
|
||||
# Project
|
||||
# from .models import Profile
|
||||
@@ -43,6 +44,22 @@ from rowsandall_app.settings import (
|
||||
|
||||
tpapilocation = "https://api.trainingpeaks.com"
|
||||
|
||||
from celery import Celery,app
|
||||
import time
|
||||
from async_messages import message_user
|
||||
|
||||
@app.task
|
||||
def addcomment(userid,id):
|
||||
time.sleep(5)
|
||||
w = Workout.objects.get(id=id)
|
||||
w.notes += '\n the task has run'
|
||||
w.save()
|
||||
u = User.objects.get(id=userid)
|
||||
message_user(u,' The task has run')
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
# Custom error class - to raise a NoTokenError
|
||||
class TPNoTokenError(Exception):
|
||||
def __init__(self,value):
|
||||
|
||||
Reference in New Issue
Block a user