def profile_qrcode_img(req):
pprof, pp_created = models.PublicProfile.objects.get_or_create(
user=req.user
)
response = HttpResponse(content_type="image/png")
qr = qrcode.QRCode(
error_correction=qrcode.constants.ERROR_CORRECT_M,
border=0,
)
qr.add_data(profile_url(pprof, req))
qr.make(fit=True)
img = qr.make_image()
img.save(response, 'png')
return response
评论列表
文章目录