Skip to content

Commit

Permalink
position stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
station committed Jul 26, 2016
1 parent 11650d6 commit 15e2866
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ def get_location(profile):
return location


class Overview(View):
def get(self, request, *args, **kwargs):

profile_list = Profile.objects.all()

return render(request, 'overview.html', {'profile_list': profile_list})



class Position(View):

def post(self, request, *args, **kwargs):
profile = Profile.objects.get(id=kwargs['account_id'])
url = 'http://'+profile.connection.hostname+':'+str(profile.connection.port)+'/position'
if ('latitude' in request.POST) and ('longitude' in request.POST)
lat = request.POST.get('latitude')
lng = request.POST.get('longitude')
data = {'lat': lat,'lng': lng, 'alt': 0}
response = requests.post(url,data=data, auth=('admin', 'secret')).json()
return HttpResponse(response)
else:
return HttpResponse("Error")


class Overview(View):
def get(self, request, *args, **kwargs):

Expand Down

0 comments on commit 15e2866

Please sign in to comment.