update
This commit is contained in:
@ -51,6 +51,7 @@ INSTALLED_APPS = [
|
|||||||
'leaflet',
|
'leaflet',
|
||||||
'leaflet_admin_list',
|
'leaflet_admin_list',
|
||||||
'rog.apps.RogConfig',
|
'rog.apps.RogConfig',
|
||||||
|
'django_filters',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
@ -165,3 +166,7 @@ LEAFLET_CONFIG = {
|
|||||||
'TILES': [('Satellite', 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {'attribution': '© ESRI', 'maxZoom': 19}),
|
'TILES': [('Satellite', 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {'attribution': '© ESRI', 'maxZoom': 19}),
|
||||||
('Streets', 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {'attribution': '© Contributors'})]
|
('Streets', 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {'attribution': '© Contributors'})]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend']
|
||||||
|
}
|
||||||
@ -394,26 +394,6 @@ def publish_date(sender, instance, created, **kwargs):
|
|||||||
updateLineTable(mdl, fields)
|
updateLineTable(mdl, fields)
|
||||||
if instance.layerof == 3:
|
if instance.layerof == 3:
|
||||||
updatePolygonTable(mdl, fields)
|
updatePolygonTable(mdl, fields)
|
||||||
# with open(csv_f, 'r') as txt_file:
|
|
||||||
# reader = csv.reader(codecs.EncodedFile(txt_file, 'utf-8', 'utf-8-sig'), delimiter=",")
|
|
||||||
# for ln in reader:
|
|
||||||
# pass
|
|
||||||
# print(str(ln))
|
|
||||||
# fields = ln.split(",")
|
|
||||||
# if instance.layerof == 2:
|
|
||||||
# updateLineTable(mdl, fields)
|
|
||||||
# if instance.layerof == 3:
|
|
||||||
# updatePolygonTable(mdl, fields)
|
|
||||||
#with open(csv, encoding='"utf-8-sig"') as txt_file:
|
|
||||||
#with open(csv, 'r') as txt_file:
|
|
||||||
# lns = txt_file.readlines()
|
|
||||||
# print(lns)
|
|
||||||
# for ln in lns:
|
|
||||||
# fields = ln.split(",")
|
|
||||||
# if instance.layerof == 2:
|
|
||||||
# updateLineTable(mdl, fields)
|
|
||||||
# if instance.layerof == 3:
|
|
||||||
# updatePolygonTable(mdl, fields)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('##################',e)
|
print('##################',e)
|
||||||
|
|||||||
@ -6,12 +6,15 @@ from .serializers import LocationSerializer, Location_lineSerializer, Location_p
|
|||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.parsers import JSONParser, MultiPartParser
|
from rest_framework.parsers import JSONParser, MultiPartParser
|
||||||
|
from .models import Location
|
||||||
|
from .serializers import LocationSerializer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LocationViewSet(viewsets.ModelViewSet):
|
class LocationViewSet(viewsets.ModelViewSet):
|
||||||
queryset=Location.objects.all()
|
queryset=Location.objects.all()
|
||||||
serializer_class=LocationSerializer
|
serializer_class=LocationSerializer
|
||||||
|
filter_fields=["prefecture", "location_name"]
|
||||||
|
|
||||||
|
|
||||||
class Location_lineViewSet(viewsets.ModelViewSet):
|
class Location_lineViewSet(viewsets.ModelViewSet):
|
||||||
@ -27,6 +30,7 @@ class Location_polygonViewSet(viewsets.ModelViewSet):
|
|||||||
class Jpn_Main_PerfViewSet(viewsets.ModelViewSet):
|
class Jpn_Main_PerfViewSet(viewsets.ModelViewSet):
|
||||||
queryset=JpnAdminMainPerf.objects.all()
|
queryset=JpnAdminMainPerf.objects.all()
|
||||||
serializer_class=JPN_main_perfSerializer
|
serializer_class=JPN_main_perfSerializer
|
||||||
|
filter_fields = ["adm1_ja"]
|
||||||
|
|
||||||
class Jpn_PerfViewSet(viewsets.ModelViewSet):
|
class Jpn_PerfViewSet(viewsets.ModelViewSet):
|
||||||
queryset=JpnAdminPerf.objects.all()
|
queryset=JpnAdminPerf.objects.all()
|
||||||
|
|||||||
Reference in New Issue
Block a user