def social_notify(request): from common.im.twitter import Twitter from common.im.blip import Blip from django.contrib.auth.models import User from msg.models import Msg if request.POST.has_key('msg'): msg = request.POST['msg'].strip() if request.POST.has_key('to_blip'): b = Blip() b.send(msg) if request.POST.has_key('to_twitter'): t = Twitter() t.send(msg) if request.POST.has_key('to_users_pl') or request.POST.has_key('to_users_en'): if request.POST.has_key('to_users_pl'): users = UserProfile.objects.filter(pref_lang='pl') else: users = UserProfile.objects.filter(pref_lang='en') for user in users: m = Msg() m.sender = request.user m.receiver = user.user m.content = msg m.is_public = False m.is_gang = False m.save() request.user.message_set.create(message="PM x%d" % len(users)) request.user.message_set.create(message="Wysłano wiadomości") return HttpResponseRedirect('/intranet/')
def handle(self, *args, **options): if len(args) != 2: print 'Wrong argument list' return if args[0].lower() == 'blip': m = Blip() elif args[0].lower() in ('tw', 'twitter'): m = Twitter() m.send(args[1].strip())
def social_notify(request): from common.im.twitter import Twitter from common.im.blip import Blip if request.POST.has_key('msg'): msg = request.POST['msg'].strip() if request.POST.has_key('to_blip'): b = Blip() b.send(msg) if request.POST.has_key('to_twitter'): t = Twitter() t.send(msg) request.user.message_set.create(message="Wysłano wiadomości") return HttpResponseRedirect('/intranet/')