def save(self, parent_msg=None): # recipients = self.cleaned_data['recipient'] recipient = self.cleaned_data['recipient'] subject = self.cleaned_data['subject'] body = self.cleaned_data['body'] # for r in recipients: r = recipient if True: msg = Message( sender = self.sender, recipient = r, subject = subject, body = body, ) if parent_msg is not None: msg.parent_msg = parent_msg parent_msg.replied_at = datetime.datetime.now() parent_msg.save() msg.conversation = parent_msg.conversation msg.save() # FIXME: workaround to make sure msg.conversation is saved # even when creating a new conversation if not msg.conversation: msg.conversation = msg msg.save() return msg