def send_digest(self): messages = self.digestmessage_set.all() full_text = "" for m in messages: full_text = full_text + m.render() + "\n" send_mail(self.subject,full_text,self.recipient.email)
# targets = target_source #else: # f = open(target_source) # data = f.readlines() # f.close() # targets = map(lambda u: u.strip(),data) #def get_user(u): # try: # return User.objects.get(username = u) # except: # print u #signator_list = map(get_user,targets) #signator_list = [o.organization.signator for o in FundingPollOrganization.objects.all()] orgs = Organization.objects.all() o_list = [] for o in orgs: if o.fundingpollorganization_set.count() == 0: o_list.append(o) #orgs = Organization.objects.filter(signator = User.objects.get(id = 1)) subject2 = "You are registered in Funding Poll" message2 = "Oops, you are really in funding poll. My apologies, I by mistake sent an email which was supposed to only go to people who are not on funding poll to all signators. My apologies, dont freak out...\n\nMichael" for o in orgs: if not o in o_list: #print o.name send_mail(subject2 ,message2 , o.signator.email)