update
This commit is contained in:
@ -93,7 +93,9 @@ class JpnAdminPerf(models.Model):
|
||||
managed = False
|
||||
db_table = 'jpn_admin_perf'
|
||||
|
||||
|
||||
###
|
||||
### Cities
|
||||
###
|
||||
class JpnSubPerf(models.Model):
|
||||
geom = models.MultiPolygonField(blank=True, null=True)
|
||||
adm0_en = models.CharField(max_length=254, blank=True, null=True)
|
||||
@ -113,7 +115,9 @@ class JpnSubPerf(models.Model):
|
||||
managed = False
|
||||
db_table = 'jpn_sub_perf'
|
||||
|
||||
|
||||
###
|
||||
### Gifu Areas
|
||||
###
|
||||
class GifuAreas(models.Model):
|
||||
geom = models.MultiPolygonField(blank=True, null=True)
|
||||
adm0_en = models.CharField(max_length=254, blank=True, null=True)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from rest_framework import urlpatterns
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from .views import LocationViewSet, Location_lineViewSet, Location_polygonViewSet, Jpn_Main_PerfViewSet, Jpn_PerfViewSet, LocationsInPerf, SubInPerf, ExtentForSubPerf, SubPerfInMainPerf, ExtentForMainPerf, LocationsInSubPerf, CatView, RegistrationAPI, LoginAPI, UserAPI, UserActionViewset, UserMakeActionViewset, UserDestinations, UpdateOrder, LocationInBound, DeleteDestination, CustomAreaLocations, GetAllGifuAreas, CustomAreaNames, userDetials, UserTracksViewSet
|
||||
from .views import LocationViewSet, Location_lineViewSet, Location_polygonViewSet, Jpn_Main_PerfViewSet, Jpn_PerfViewSet, LocationsInPerf, SubInPerf, ExtentForSubPerf, SubPerfInMainPerf, ExtentForMainPerf, LocationsInSubPerf, CatView, RegistrationAPI, LoginAPI, UserAPI, UserActionViewset, UserMakeActionViewset, UserDestinations, UpdateOrder, LocationInBound, DeleteDestination, CustomAreaLocations, GetAllGifuAreas, CustomAreaNames, userDetials, UserTracksViewSet, CatByCity
|
||||
from django.urls import path, include
|
||||
from knox import views as knox_views
|
||||
|
||||
@ -28,6 +28,7 @@ urlpatterns += [
|
||||
path('perfext/', ExtentForSubPerf, name="sub_perf_ext"),
|
||||
path('mainperfext/', ExtentForMainPerf, name="main_perf_ext"),
|
||||
path('cats/', CatView, name='cats'),
|
||||
path('catbycity/', CatByCity, name='cat_by_city'),
|
||||
path('register/', RegistrationAPI.as_view()),
|
||||
path('login/', LoginAPI.as_view()),
|
||||
path('user/', UserAPI.as_view()),
|
||||
|
||||
12
rog/views.py
12
rog/views.py
@ -174,6 +174,18 @@ def CatView(request):
|
||||
return JsonResponse(serializer.data, safe=False)
|
||||
|
||||
|
||||
def CatByCity(request):
|
||||
city = request.GET.get('city')
|
||||
if(city != None):
|
||||
cilt_polygon = JpnSubPerf.objects.filter(adm1_ja=city)
|
||||
cats = Location.objects.filter(geom__within=cilt_polygon[0].geom).values('category').distinct()
|
||||
serializer = LocationCatSerializer(cats, many=True)
|
||||
return JsonResponse(serializer.data, safe=False)
|
||||
else:
|
||||
return null
|
||||
|
||||
|
||||
|
||||
class RegistrationAPI(generics.GenericAPIView):
|
||||
serializer_class = CreateUserSerializer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user