first commit

This commit is contained in:
2022-02-08 16:44:09 +05:30
commit d366be57a1
25 changed files with 909 additions and 0 deletions

167
.gitignore vendored Normal file
View File

@ -0,0 +1,167 @@
# Created by https://www.toptal.com/developers/gitignore/api/django
# Edit at https://www.toptal.com/developers/gitignore?templates=django
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly.
# <django-project-name>/staticfiles/
### Django.Python Stack ###
# Byte-compiled / optimized / DLL files
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
# Django stuff:
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# End of https://www.toptal.com/developers/gitignore/api/django

55
Dockerfile.gdal Normal file
View File

@ -0,0 +1,55 @@
# FROM python:3.9.9-slim-buster
FROM osgeo/gdal:ubuntu-small-3.4.0
WORKDIR /app
LABEL maintainer="nouffer@gmail.com"
LABEL description="Development image for the Rogaining JP"
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ARG TZ Asia/Tokyo \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y
# Install GDAL dependencies
RUN apt-get install -y libgdal-dev g++ --no-install-recommends && \
apt-get clean -y
# Update C env vars so compiler can find gdal
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
ENV C_INCLUDE_PATH=/usr/include/gdal
RUN apt-get update \
&& apt-get -y install netcat gcc postgresql \
&& apt-get clean
RUN apt-get update \
&& apt-get install -y binutils libproj-dev gdal-bin python3-gdal
RUN apt-get install -y libcurl4-openssl-dev libssl-dev
RUN apt-get install -y libspatialindex-dev
RUN apt-get install -y python3
RUN apt-get update && apt-get install -y \
python3-pip
RUN pip install --upgrade pip
RUN apt-get update
COPY ./requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
COPY . /app

33
Makefile Normal file
View File

@ -0,0 +1,33 @@
ifneq (,$(wildcard ./.env))
include .env
export
ENV_FILE_PARAM = --env-file .env
endif
build:
docker-compose up --build -d --remove-orphans
up:
docker-compose up -d
down:
docker-compose down
logs:
docker-compose logs
migrate:
docker-compose exec api python3 manage.py migrate --noinput
makemigrations:
docker-compose exec api python3 manage.py makemigrations
superuser:
docker-compose exec api python3 manage.py createsuperuser
down-v:
docker-compose down -v
volume:
docker volume inspect rog_src_postgres_data
shell:
docker-compose exec api python3 manage.py shell

0
config/__init__.py Normal file
View File

16
config/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for config project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
application = get_asgi_application()

167
config/settings.py Normal file
View File

@ -0,0 +1,167 @@
"""
Django settings for config project.
Generated by 'django-admin startproject' using Django 3.2.9.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
import environ
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
env = environ.Env(DEBUG=(bool, False))
environ.Env.read_env(env_file=".env")
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
#SECRET_KEY = 'django-insecure-@!z!i#bheb)(o1-e2tss(i^dav-ql=cm4*+$unm^3=4)k_ttda'
SECRET_KEY = env("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
#DEBUG = True
DEBUG = env("DEBUG")
#ALLOWED_HOSTS = []
ALLOWED_HOSTS = env("ALLOWED_HOSTS").split(" ")
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'rest_framework',
'rest_framework_gis',
'leaflet',
'leaflet_admin_list',
'rog.apps.RogConfig',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'config.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'config.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': env("POSTGRES_DBNAME"),
'USER': env("POSTGRES_USER"),
'PASSWORD': env("POSTGRES_PASS"),
'HOST': env("PG_HOST"),
'PORT': env("PG_PORT")
}
}
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Tokyo'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/'
#STATIC_URL = '/static2/'
STATIC_ROOT = BASE_DIR / "static"
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / "media/"
#STATICFILES_DIRS = (os.path.join(BASE_DIR, "static2"),os.path.join(BASE_DIR, "media"))
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LEAFLET_CONFIG = {
'DEFAULT_CENTER': (35.41864442627996, 138.14094040951784),
'DEFAULT_ZOOM': 6,
'MIN_ZOOM': 3,
'MAX_ZOOM': 19,
'DEFAULT_PRECISION': 6,
'SCALE':"both",
'ATTRIBUTION_PREFIX':"ROGAINING API",
'TILES': [('Satellite', 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {'attribution': '&copy; ESRI', 'maxZoom': 19}),
('Streets', 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {'attribution': '&copy; Contributors'})]
}

28
config/urls.py Normal file
View File

@ -0,0 +1,28 @@
"""config URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include("rog.urls")),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
admin.site.site_header = "ROGANING"
admin.site.site_title = "Roganing Admin Portal"
admin.site.index_title = "Welcome to Roganing Portal"

16
config/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for config project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
application = get_wsgi_application()

42
docker-compose.yaml Normal file
View File

@ -0,0 +1,42 @@
version: "3.9"
services:
api:
build:
context: .
dockerfile: Dockerfile.gdal
command: python3 manage.py runserver 0.0.0.0:8100
volumes:
- .:/app
ports:
- 8100:8100
env_file:
- .env
restart: "on-failure"
depends_on:
- postgres-db
networks:
- rog-api
postgres-db:
image: kartoza/postgis:12.0
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASS=${POSTGRES_PASS}
- POSTGRES_DBNAME=${POSTGRES_DBNAME}
restart: "on-failure"
networks:
- rog-api
networks:
rog-api:
driver: bridge
volumes:
postgres_data:
geoserver-data:

55
dockerignore Normal file
View File

@ -0,0 +1,55 @@
# Docker/Podman image doesn't need any files that git doesn't track.
#Therefore the .dockerignore largely follows the structure of .gitignore.
# C extensions
*.so
# Packages
*.egg*
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Installer logs
pip-log.txt
# Unit test / coverage reports
cover/
.coverage*
!.coveragerc
.tox
nosetests.xml
.testrepository
.venv
.stestr/*
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Complexity
output/*.html
output/*/index.html
# Sphinx
doc/build
doc/source/reference/api/
# pbr generates these
AUTHORS
ChangeLog
# Editors
*~
.*.swp
.*sw?
# Files created by releasenotes build
releasenotes/build
# Ansible specific
hosts
*.retry
#Vagrantfiles, since we are using docker
Vagrantfile.*

22
manage.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

64
requirements.txt Normal file
View File

@ -0,0 +1,64 @@
affine==2.3.0
asgiref==3.4.1
attrs==21.2.0
black==21.11b0
certifi==2021.10.8
charset-normalizer==2.0.8
click==8.0.3
click-plugins==1.1.1
cligj==0.7.2
cycler==0.11.0
Django==3.2.9
django-adminlte-3==0.1.6
django-environ==0.8.1
django-filter==21.1
django-leaflet==0.28.2
django-leaflet-admin-list==0.0.4
django-suit==2.0a1
djangorestframework==3.12.4
djangorestframework-gis==0.17
Fiona==1.8.20
flake8==4.0.1
fonttools==4.28.2
# GDAL==3.3.0
GeoAlchemy2==0.9.4
geopandas==0.10.2
geoserver-rest==2.1.4
greenlet==1.1.2
idna==3.3
kiwisolver==1.3.2
matplotlib==3.5.0
mccabe==0.6.1
munch==2.5.0
mypy-extensions==0.4.3
numpy==1.21.4
packaging==21.3
pandas==1.3.4
pathspec==0.9.0
Pillow==8.4.0
platformdirs==2.4.0
psycopg2-binary==2.9.2
pycodestyle==2.8.0
pycurl==7.44.1
pyflakes==2.4.0
Pygments==2.10.0
pyparsing==3.0.6
pyproj==3.3.0
python-dateutil==2.8.2
pytz==2021.3
rasterio==1.2.10
regex==2021.11.10
requests==2.26.0
Rtree==0.9.7
scipy==1.7.3
seaborn==0.11.2
setuptools-scm==6.3.2
Shapely==1.8.0
six==1.16.0
snuggs==1.4.7
SQLAlchemy==1.4.27
sqlparse==0.4.2
tomli==1.2.2
typing_extensions==4.0.0
urllib3==1.26.7
django-extra-fields==3.0.2

0
rog/__init__.py Normal file
View File

23
rog/admin.py Normal file
View File

@ -0,0 +1,23 @@
from django.contrib import admin
from leaflet.admin import LeafletGeoAdmin
from leaflet.admin import LeafletGeoAdminMixin
from leaflet_admin_list.admin import LeafletAdminListMixin
from .models import RogEvent, Shop, EventRoute, ShopRoute
class RogAdmin(LeafletAdminListMixin, LeafletGeoAdminMixin, admin.ModelAdmin):
list_display=['title', 'venue', 'at_date',]
class ShopAdmin(LeafletAdminListMixin, LeafletGeoAdminMixin, admin.ModelAdmin):
list_display=['name',]
class EventRouteAdmin(LeafletAdminListMixin, LeafletGeoAdminMixin, admin.ModelAdmin):
list_display=['name',]
class ShopRouteAdmin(LeafletAdminListMixin, LeafletGeoAdminMixin, admin.ModelAdmin):
list_display=['name',]
admin.site.register(RogEvent, RogAdmin)
admin.site.register(Shop, ShopAdmin)
admin.site.register(EventRoute, EventRouteAdmin)
admin.site.register(ShopRoute, ShopRouteAdmin)

6
rog/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class RogConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'rog'

View File

@ -0,0 +1,33 @@
# Generated by Django 3.2.9 on 2022-02-04 06:00
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RogEvent',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255, verbose_name='Title')),
('venue', models.CharField(max_length=255, verbose_name='Venue')),
('at_date', models.DateTimeField(auto_now_add=True, verbose_name='At Date')),
('geom', django.contrib.gis.db.models.fields.MultiPointField(srid=4326)),
],
),
migrations.CreateModel(
name='Shops',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='Shop name')),
('geom', django.contrib.gis.db.models.fields.MultiPointField(srid=4326)),
],
),
]

View File

@ -0,0 +1,17 @@
# Generated by Django 3.2.9 on 2022-02-04 11:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rog', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='Shops',
new_name='Shop',
),
]

View File

@ -0,0 +1,24 @@
# Generated by Django 3.2.9 on 2022-02-04 17:17
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rog', '0002_rename_shops_shop'),
]
operations = [
migrations.CreateModel(
name='EventRoute',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='Name')),
('geom', django.contrib.gis.db.models.fields.MultiLineStringField(srid=4326)),
('event', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='rog.rogevent')),
],
),
]

View File

@ -0,0 +1,24 @@
# Generated by Django 3.2.9 on 2022-02-04 17:23
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rog', '0003_eventroute'),
]
operations = [
migrations.CreateModel(
name='ShopRoute',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='Name')),
('geom', django.contrib.gis.db.models.fields.MultiLineStringField(srid=4326)),
('shop', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='rog.shop')),
],
),
]

View File

37
rog/models.py Normal file
View File

@ -0,0 +1,37 @@
from django.contrib.gis.db import models
from django.utils.translation import gettext_lazy as _
class RogEvent(models.Model):
title=models.CharField(_('Title'), max_length=255)
venue=models.CharField(_('Venue'), max_length=255)
at_date=models.DateTimeField(_('At Date'), auto_now_add=True)
geom=models.MultiPointField(srid=4326)
def __str__(self):
return self.title
class EventRoute(models.Model):
name = models.CharField(_("Name"), max_length=255)
event = models.OneToOneField(RogEvent, on_delete=models.CASCADE)
geom = models.MultiLineStringField(srid=4326)
def __str__(self):
return self.name
class Shop(models.Model):
name=models.CharField(_('Shop name'), max_length=255)
geom=models.MultiPointField(srid=4326)
def __str__(self):
return self.name
class ShopRoute(models.Model):
name = models.CharField(_("Name"), max_length=255)
shop = models.OneToOneField(Shop, on_delete=models.CASCADE)
geom = models.MultiLineStringField(srid=4326)
def __str__(self):
return self.name

32
rog/serializers.py Normal file
View File

@ -0,0 +1,32 @@
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from sqlalchemy.sql.functions import mode
from .models import RogEvent, Shop, EventRoute, ShopRoute
from drf_extra_fields.fields import Base64ImageField
class RogEventSerializer(GeoFeatureModelSerializer):
class Meta:
model=RogEvent
geo_field="geom"
fields="__all__"
class ShopSerializer(GeoFeatureModelSerializer):
class Meta:
model=Shop
geo_field="geom"
fields="__all__"
class EventRouteSerializer(GeoFeatureModelSerializer):
class Meta:
model=EventRoute
geo_field="geom"
fields="__all__"
class ShopRouteSerializer(GeoFeatureModelSerializer):
class Meta:
model=ShopRoute
geo_field="geom"
fields="__all__"

3
rog/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

14
rog/urls.py Normal file
View File

@ -0,0 +1,14 @@
from rest_framework import urlpatterns
from rest_framework.routers import DefaultRouter
from .views import RogEventViewSet, EventRouteViewSet, ShopViewSet, ShopRouteViewSet
from django.urls import path, include
router = DefaultRouter()
router.register(prefix='v1/rog', viewset=RogEventViewSet, basename='rog')
router.register(prefix='v1/eventroute', viewset=EventRouteViewSet, basename='eventroute')
router.register(prefix='v1/shop', viewset=ShopViewSet, basename='shop')
router.register(prefix='v1/shoproute', viewset=ShopRouteViewSet, basename='shoproute')
urlpatterns = router.urls

31
rog/views.py Normal file
View File

@ -0,0 +1,31 @@
from django.core.serializers import serialize
from .models import RogEvent, ShopRoute, EventRoute, Shop
from rest_framework import viewsets
from .serializers import RogEventSerializer, EventRouteSerializer, ShopSerializer, ShopRouteSerializer
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.parsers import JSONParser, MultiPartParser
class RogEventViewSet(viewsets.ModelViewSet):
queryset=RogEvent.objects.all()
serializer_class=RogEventSerializer
class EventRouteViewSet(viewsets.ModelViewSet):
queryset=EventRoute.objects.all()
serializer_class=EventRouteSerializer
class ShopViewSet(viewsets.ModelViewSet):
queryset=Shop.objects.all()
serializer_class=ShopSerializer
class ShopRouteViewSet(viewsets.ModelViewSet):
queryset=ShopRoute.objects.all()
serializer_class=ShopRouteSerializer