在导入过程中,我确保将img
s 标记为可编辑,并将几个内容部分放入multiline
构造中。导入的模板显示在客户端的模板集中,但是当我尝试编辑它们时,我只显示了 zip/HTML 上传选项而不是实际的编辑器:
从我的代码库中,我自己的模板对象具有导出代码:
class EmailBodyTemplate(models.Model):
...
def migrate_email_template(self, cm_client_id, cm_token):
cm_template = Template(cm_token)
# Basically I expose a specially tailored HTML version of my template
# for CM: adding editable to imgs, introducing multiline wrappers and
# adding unsubscribe, view in browser and other special links
html_url = settings.HOME_URL + reverse('email_import_view', args=(self.id,))
template_id = cm_template.create(cm_client_id, self.name, html_url, None)
self.template_id = template_id
self.save()