不管出于什么原因,在记录的UUID中插入了一个随机空间。我发邮件让人们点击确认或取消链接来更新我数据库中的记录。我使用UUID来确保他们更新了正确的记录。在
我在我的表单.py-如果我只有取消捐赠链接,它工作得很好。一旦确认链接被添加。它在取消的链接UUID之间添加一个空格。在
for special_word in values['special_words']:
print special_word
text = values['text']
print text
uuid = rescheduled_donor.uuid
if special_word == "confirm_donation_link":
values['text'] = text.replace(
special_word,
'<a href="http://{0}/actions/email_blasts/confirm/' \
'{1}">Confirm Donation</a>'.format(
domain,
uuid
)
)
values['special_words'].remove(special_word)
continue
if special_word == "cancel_donation_link":
values['text'] = text.replace(
special_word,
'<a href="http://{0}/actions/email_blasts/cancel/' \
'{1}">Cancel</a>'.format(
domain,
uuid
)
)
values['special_words'].remove(special_word)
continue
在我把所有的上下文发送到电子邮件模板之前,我打印出一个html,在UUID之间没有空格
^{pr2}$发送电子邮件后,URL在UUID部分有一个空格。它被替换为%20。 取消
模板
<div style="color:#500050">
<img src="{{ STATIC_URL}}images/email_logo2.jpg">
<p>
{{ message|safe }}
</p>
<p>
{% for image in pages %}
<img src="{{ MEDIA_URL }}{{ image }}">
{% endfor %}
</p>
<p>
{{ closing_message|safe }}
</p>
</div>
~
我不知道为什么或如何插入这个随机空间。在
来自电子邮件的HTML
<div style="color:#500050">
</p><div>If you have any questions or need any assistance you may reply by e-mail or call customer service <a href="tel:631-234-0000" value="+16312340000" target="_blank">631-234-0000</a>.<br></div><div><br></div><div><br></div><div>To confirm this new date, click here: <a href="http://127.0.0.1:8000/actions/email_blasts/confirm/1544ce69-3c44-4554-839a-a2fd09f049e3" target="_blank">Confirm Donation</a> </div><div><br></div><div>To pick a different date, click here: <a href="http://127.0.0.1:8000/external/1544ce69-3c44-4554-839a-a2fd09f049e3/" target="_blank">Donate</a> </div><div><br></div><div>To cancel your donation, click here: <a href="http://127.0.0.1:8000/actions/email_blasts/cancel/1544ce%2069-3c44-4554-839a-a2fd09f049e3" target="_blank">Cancel</a> <br></div>
<p></p>
<p>
</p>
<p>
<br>
</p>
</div>
最后我改变了URL的字符串部分,使用reverse函数,而不是硬编码它。我还注意到,与在我的webfection服务器上的登台站点相比,在我的笔记本电脑上运行它时有一点不同。在
相关问题 更多 >
编程相关推荐