Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 celery_tasks.py

View raw Download
text/x-script.python • 481 B
Python script, ASCII text executable
        
            
1
import time
2
from celery import shared_task
3
from app import db
4
from models import *
5
from smtplib import SMTP
6
import config
7
8
9
@shared_task(ignore_result=False)
10
def send_notification(notification_id, users, level):
11
notification = db.session.get(Notification, notification_id)
12
13
for user in users:
14
db.session.add(UserNotification(db.session.get(User, user), notification, level))
15
db.session.commit()
16
17
return 0 # notification sent successfully
18