def open_message_thread(recipients, subject, template, sender, context={}, send=True, message=None): body = "" if template: t = get_template(template) body = t.render(Context({})) else: body = message from forms import ComposeForm # temporary here to remove circular dependence compose_form = ComposeForm(data={"recipient": recipients, "subject": subject, "body": body}) if compose_form.is_valid(): (thread, new_message) = compose_form.save(sender=sender, send=send) return (thread, new_message)
def open_message_thread(recipients, subject, template, sender, context={}, send=True, message=None): body = '' if template: t = get_template(template) body = t.render(Context(context)) else: body = message from forms import ComposeForm # temporary here to remove circular dependence compose_form = ComposeForm(data={ "recipient": recipients, "subject": subject, "body": body }) if compose_form.is_valid(): (thread, new_message) = compose_form.save(sender=sender, send=send) return (thread, new_message)