def get_lat_lang_qrcode(request, *args, **kwargs):
    if request.method == 'POST':
        lat_lang_form = LatLangForm(request.POST)
        if lat_lang_form.is_valid():
            latitude = lat_lang_form.cleaned_data['lat_lang_latitude']
            longitude = lat_lang_form.cleaned_data['lat_lang_longitude']
            config = helpers.make_geo_data(latitude, longitude)
            image = segno.make(config, micro=False, error="H")
            buffer = BytesIO()
            image.save(buffer, "PNG", scale=7, dark='black', light='white')
            img_str = base64.b64encode(buffer.getvalue())
            return str(img_str.decode("utf-8"))
Beispiel #2
0
def test_geo_data2():
    data = helpers.make_geo_data(38.89,-77.0365297)
    assert 'geo:38.89,-77.0365297' == data
Beispiel #3
0
def test_geo_data2():
    data = helpers.make_geo_data(38.89,-77.0365297)
    assert 'geo:38.89,-77.0365297' == data