def get_template(template): if isinstance(template, MessageTemplate): return template if type(template) in [str, unicode, ObjectId]: return MessageTemplate.objects(pk=str(template)).first() else: return None
def template_edit(type='email', id=None): return render_template( 'message_templates/edit.html', template=MessageTemplate.objects(pk=str(id)).first(), type=type)
def templates(type='email'): return render_template('message_templates/list.html', templates=MessageTemplate.objects(type=type).all(), type=type)
def template_view(type='email', id=None): return render_template('message_templates/view.html', template=MessageTemplate.objects(pk=str(id)).first(), type=type)