change schema to save

This commit is contained in:
ilia 2023-05-27 23:59:50 +03:00
parent bc173cdbee
commit c731886dc6
2 changed files with 42 additions and 30 deletions

View File

@ -111,6 +111,10 @@ def post(self, request):
region = None region = None
res = []
for _ in range(5):
if city_id: if city_id:
region = get_object_or_404(City, oid=city_id) region = get_object_or_404(City, oid=city_id)
else: else:
@ -140,9 +144,14 @@ def post(self, request):
where_eat=where_eat, where_eat=where_eat,
what_to_see=what_to_see what_to_see=what_to_see
) )
print(len(tour[1])) res.append({
'city': region.title,
'date_from': start_date,
'date_to': end_date,
'path': tour[0]
})
return Response(data=tour[0]) return Response(data=res)
class ListRegionApiView(ListAPIView): class ListRegionApiView(ListAPIView):

View File

@ -482,7 +482,8 @@ def generate_point(point: BasePoint):
"type": "point", "type": "point",
"point": event_data, "point": event_data,
"point_type": "point", "point_type": "point",
"time": timedelta(minutes=90+choice(range(-10, 90, 10))).seconds "time": timedelta(minutes=90+choice(range(-10, 90, 10))).seconds,
"distance": 0
} }
@ -555,6 +556,8 @@ def generate_hotel(hotel: Hotel):
"type": "point", "type": "point",
"point": hotel_data, "point": hotel_data,
"point_type": "hotel", "point_type": "hotel",
"time": 0,
"distance": 0
} }