python短信发送查询数据库结果_向Django数据库中的每个号码发送短信
使用python/django/twilio向每個(gè)員工都有“管理”關(guān)系的表中的員工發(fā)送SMS時(shí)遇到問(wèn)題
表Employees包含:
fname,lname,電話號(hào)碼,組
在視圖.py在def contact(request):
if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
client = twilio.rest.TwilioRestClient('xx...', 'xxx...')
recipients = employees.objects.filter(group__contains='admin')
for number in recipients:
client.messages.create(body='Sample text',to=number, from_='xxxxxx')
return HttpResponseRedirect('/contact/thanks/')
else:
form = ContactForm()
return render(request, 'contact_form.html', {'form':form})
“收件人”。。。。我的代碼行似乎是罪魁禍?zhǔn)住V械摹皀umber”值出現(xiàn)錯(cuò)誤消息client.messages.create行:值錯(cuò)誤:數(shù)據(jù)應(yīng)該是整數(shù)、二進(jìn)制、字符串或序列。在
在模型.py在
^{pr2}$
感謝任何幫助!在
謝謝
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的python短信发送查询数据库结果_向Django数据库中的每个号码发送短信的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 华为mate20跑马灯怎么设置
- 下一篇: python dll是什么意思