]> git.parisson.com Git - teleforma.git/commitdiff
add jqchat broadcast message command
authoryomguy <yomguy@parisson.com>
Tue, 5 Feb 2013 14:53:19 +0000 (15:53 +0100)
committeryomguy <yomguy@parisson.com>
Tue, 5 Feb 2013 14:53:19 +0000 (15:53 +0100)
teleforma/management/commands/teleforma-broadcast-message.py [new file with mode: 0644]

diff --git a/teleforma/management/commands/teleforma-broadcast-message.py b/teleforma/management/commands/teleforma-broadcast-message.py
new file mode 100644 (file)
index 0000000..c2628ab
--- /dev/null
@@ -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)
+