From: Guillaume Pellerin Date: Fri, 6 Dec 2013 20:37:44 +0000 (+0100) Subject: add room broadcast command X-Git-Tag: 2.8.1-pro~482^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f10799c3a829130177c6a16494eb90f9db95ed17;p=teleforma.git add room broadcast command --- diff --git a/teleforma/management/commands/teleforma-broadcast-message.py b/teleforma/management/commands/teleforma-broadcast-message.py new file mode 100644 index 00000000..77b691df --- /dev/null +++ b/teleforma/management/commands/teleforma-broadcast-message.py @@ -0,0 +1,19 @@ +from optparse import make_option +from django.conf import settings +from django.core.management.base import BaseCommand, CommandError +from django.contrib.auth.models import User +from jqchat.models import * + + +class Command(BaseCommand): + help = "Broadcast a jqchat message on the main site room by the admin" + args = "username text" + + def handle(self, *args, **options): + text = args[1] + username = args[0] + user = User.objects.get(username=username) + rooms = Room.objects.filter(name__contains='site') + for room in rooms: + message = Message.objects.create_message(user, room, text) +