25 lines
771 B
Python
25 lines
771 B
Python
|
from django.urls import reverse
|
||
|
from django.core.management.base import BaseCommand
|
||
|
|
||
|
from gotify import models
|
||
|
|
||
|
|
||
|
class Command(BaseCommand):
|
||
|
help = 'Notifies all users to take a vitals measurement now.'
|
||
|
|
||
|
def handle(self, *args, **kwargs):
|
||
|
applications = models.GotifyApplication.objects.all()
|
||
|
|
||
|
for application in applications:
|
||
|
message_text = f"Hello {application.user.user.first_name}. Please take your next vitals measurement now."
|
||
|
message_title = "Medwings Measurement Prompt"
|
||
|
url = reverse('mews-init')
|
||
|
|
||
|
message = models.GotifyMessage(
|
||
|
message=message_text,
|
||
|
title=message_title,
|
||
|
url=url
|
||
|
)
|
||
|
|
||
|
application.send_message(message)
|