如何在 django-oscar 通知系统中自定义通知消息
How do I customize the notification message in django-oscar notification system
如何自定义 accounts/notifications
上显示的通知消息
此页面缺少内容,通知正文显示如下:-
<a href="/catalogue/test-product_6/">test product</a>
有货
而不是产品的可点击 link
我尝试编辑 message.html 模板,但没有发生任何变化
我只需要在模板中知道customer/notifications/detail。html
{{ notification.body }} 来自哪个模板?
我应该怎么做才能解决这个问题 link
注意:发送给用户的电子邮件是正确的 link,我可以通过数据库中的通信事件对其进行自定义
是否也有任何选项可以从数据库自定义通知模板?
提前致谢
如您所述,通知是从 customer/notifications/detail.html
呈现的。
问题是 HTML 被传递到通知正文,但模板是 rendering it as an unsafe string(即 HTML 被转义)。
这看起来像是 Oscar 中的一个错误,我已经为它制作了一个 issue。
与此同时,您需要重写此模板才能更改:
<td>{{ notification.body }}</td>
至:
<td>{{ notification.body|safe }}</td>
如何自定义 accounts/notifications
上显示的通知消息此页面缺少内容,通知正文显示如下:-
<a href="/catalogue/test-product_6/">test product</a>
有货
而不是产品的可点击 link
我尝试编辑 message.html 模板,但没有发生任何变化
我只需要在模板中知道customer/notifications/detail。html {{ notification.body }} 来自哪个模板?
我应该怎么做才能解决这个问题 link
注意:发送给用户的电子邮件是正确的 link,我可以通过数据库中的通信事件对其进行自定义 是否也有任何选项可以从数据库自定义通知模板?
提前致谢
如您所述,通知是从 customer/notifications/detail.html
呈现的。
问题是 HTML 被传递到通知正文,但模板是 rendering it as an unsafe string(即 HTML 被转义)。
这看起来像是 Oscar 中的一个错误,我已经为它制作了一个 issue。
与此同时,您需要重写此模板才能更改:
<td>{{ notification.body }}</td>
至:
<td>{{ notification.body|safe }}</td>