removing notification for new workout sync, adding CN liked KML api
This commit is contained in:
@@ -252,7 +252,7 @@ Optional, not for CN
|
||||
- Update one or more new courses from KML
|
||||
"""
|
||||
@api_view(["GET"])
|
||||
@permission_classes([AllowAny])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def course_list(request):
|
||||
if request.method != 'GET': # pragma: no cover
|
||||
dologging('apilog.log','{m} request to KML endpoint'.format(m=request.method))
|
||||
@@ -305,7 +305,7 @@ def course_list(request):
|
||||
return JsonResponse(response_dict, content_type='application/json; charset=utf8')
|
||||
|
||||
@api_view(["GET"])
|
||||
@permission_classes([AllowAny])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def get_crewnerd_kml(request,id=0):
|
||||
if request.method != 'GET': # pragma: no cover
|
||||
dologging('apilog.log','{m} request to CrewNerd KML endpoint'.format(m=request.method))
|
||||
@@ -318,11 +318,11 @@ def get_crewnerd_kml(request,id=0):
|
||||
|
||||
kml = coursetokml(c, cn=True)
|
||||
|
||||
return HttpResponse(kml)
|
||||
return HttpResponse(kml, content_type='text/xml')
|
||||
|
||||
#@csrf_exempt
|
||||
@csrf_exempt
|
||||
@api_view(["GET"])
|
||||
@permission_classes([AllowAny])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def get_crewnerd_multiple(request):
|
||||
if request.method != 'GET': # pragma: no cover
|
||||
dologging('apilog.log','{m} request to CrewNerd KML endpoint'.format(m=request.method))
|
||||
@@ -344,7 +344,34 @@ def get_crewnerd_multiple(request):
|
||||
|
||||
kml = coursestokml(ids, cn=True)
|
||||
|
||||
return HttpResponse(kml)
|
||||
return HttpResponse(kml, content_type='text/xml')
|
||||
|
||||
@csrf_exempt
|
||||
@api_view(["GET"])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def get_crewnerd_liked(request):
|
||||
r = getrower(request.user)
|
||||
if request.method != 'GET': # pragma: no cover
|
||||
dologging('apilog.log','{m} request to CrewNerd KML endpoint'.format(m=request.method))
|
||||
return HttpResponseNotAllowed("Method not supported")
|
||||
|
||||
ids = request.GET.get('id')
|
||||
if ids is not None:
|
||||
tdict = dict(request.GET.lists())
|
||||
idsnew = []
|
||||
for id in tdict['id']:
|
||||
try:
|
||||
idsnew.append(int(id))
|
||||
except ValueError:
|
||||
pass
|
||||
ids = idsnew
|
||||
else:
|
||||
gcs = GeoCourse.objects.filter(followers=r)
|
||||
ids = [c.id for c in gcs]
|
||||
|
||||
kml = coursestokml(ids, cn=True)
|
||||
|
||||
return HttpResponse(kml, content_type='text/xml')
|
||||
|
||||
# Stroke data views
|
||||
|
||||
|
||||
Reference in New Issue
Block a user