Reputation: 516
Why am I seeing this error? Is there any problem in the django
method below?
def email_send(request):
data = json.loads(request.body)
email_conf = getEmailConf(data)
mail_message = getFormattedMsg(data)
try:
t = threading.Thread(target=send_mail,args=[email_conf['subject'],mail_message , email_conf['from_addr'],[email_conf['to_addr'],]],kwargs={'fail_silently':False})
t.setDaemon(True)
t.start()
except:
print "Exception in sending Mail:"
print data
print email_conf
response= email_conf['response']
try:
if data['id']==8:
response={'redirect2thankupage'}
except:
pass
return HttpResponse(response)
Upvotes: 0
Views: 885
Reputation: 55864
Django is warning you that in a future release, HttpResponse
will only accept strings as content.
In the case where data['id'] == 8
you are passing a set
. You can probably just pass a string here.
For reference, see the docs here and here.
Upvotes: 2