from django.shortcuts import render, redirect
# from django import forms
from django.http import HttpResponse

from standbase.models import *

from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST


import logging
logger = logging.getLogger('testlogger')

    
def index(request):
    return render(request, 'standbase/index.html', {
        
    })


@csrf_exempt
@require_POST
def catch(request):
	lat = float(request.POST.get('lat', ''))
	lon = float(request.POST.get('lon', ''))

	vendorid = request.POST.get('vendorid', '')

	s = StandSession.objects.create(lat=lat, lon=lon, vendorid=vendorid)

	return HttpResponse('{"sessionid": %d}' % s.id, content_type='application/json')
@@ -397,17 +397,16 @@
     %7D)%0A%0A
-%0A
 @csrf_ex
@@ -653,29 +653,22 @@
 %0A%09re
-turn HttpResponse('%7B%22
+sponse = %7B%0A%09%09'
 sess
@@ -676,22 +676,82 @@
 onid
-%22: %25d%7D' %25 s.id
+': s.id,%0A%09%09'secret': s.secret%0A%09%7D%0A%09return HttpResponse(json.dumps(response)
 , co

create a fuller response