def qrcode_image_url(qr_data): """Returns the URL to the QR Code image of `qr_data` """ if qr_data: from htk.lib.qrcode.utils import generate_qr_key from htk.utils import htk_setting url_name = htk_setting('HTK_QR_IMAGE_URL_NAME') if url_name: qr_params = urllib.urlencode( { 'key': generate_qr_key(qr_data), 'data': qr_data, } ) image_url = '%s?%s' % (reverse(url_name), qr_params,) else: image_url = None else: image_url = None return image_url
def qrcode_image_url(qr_data): """Returns the URL to the QR Code image of `qr_data` """ if qr_data: from htk.lib.qrcode.utils import generate_qr_key from htk.utils import htk_setting url_name = htk_setting('HTK_QR_IMAGE_URL_NAME') if url_name: qr_params = urllib.parse.urlencode( { 'key': generate_qr_key(qr_data), 'data': qr_data, } ) image_url = '%s?%s' % (reverse(url_name), qr_params,) else: image_url = None else: image_url = None return image_url