Example #1
0
	def create(self, request, *args, **kwargs):
		vcode = randint(100000,999999)
		num, _ =  Sms.objects.get_or_create(number=request.DATA["number"])
		num.vcode = vcode
		num.save()
		resp = smsutils.templateSMS(settings.UCPAASSID,
				settings.UCPAASTOKEN,
				settings.UCPAASAPPID,
				num.number,
				settings.UCPAASTEMPLATE,
				str(vcode) + "," + "2")

		print resp
		serializer = SmsVcodeSerializer(num)
		return Response(serializer.data, status=status.HTTP_200_OK)