From: yomguy Date: Tue, 5 Feb 2013 14:53:19 +0000 (+0100) Subject: add jqchat broadcast message command X-Git-Tag: 1.1~636 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=84365a2daabe332fe9f4f0947141ae587e6440e7;p=teleforma.git add jqchat broadcast message 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..c2628ab3 --- /dev/null +++ b/teleforma/management/commands/teleforma-broadcast-message.py @@ -0,0 +1,18 @@ +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 = "Braodcast a jqchat message on the main site room by the admin" + args = "text username" + + def handle(self, *args, **options): + text = args[0] + username = args[1] + user = User.objects.get(username=username) + room = Room.objects.get(name='site') + message = Message.objects.create_message(user, room, text) +