This commit is contained in:
Mohamed Nouffer
2022-03-14 10:50:11 +05:30
parent 3a5b56aac5
commit 3dd2ccf56e
20 changed files with 1283 additions and 1245 deletions

View File

@ -70,13 +70,13 @@ class Location(models.Model):
videos=models.CharField(_('Videos'), max_length=255, blank=True, null=True)
webcontents=models.CharField(_('Web Content'), max_length=255, blank=True, null=True)
status=models.CharField(_('Status'),max_length=255, blank=True, null=True)
portal=models.CharField(_('Status'), max_length=255,blank=True, null=True)
group=models.CharField(_('Status'), max_length=255,blank=True, null=True)
phone=models.CharField(_('Status'), max_length=255,blank=True, null=True)
fax=models.CharField(_('Status'), max_length=255, blank=True, null=True)
portal=models.CharField(_('Portal'), max_length=255,blank=True, null=True)
group=models.CharField(_('Group'), max_length=255,blank=True, null=True)
phone=models.CharField(_('Phone'), max_length=255,blank=True, null=True)
fax=models.CharField(_('Fax'), max_length=255, blank=True, null=True)
email=models.EmailField(_('Email'), max_length=255,blank=True, null=True)
facility=models.CharField(_('Status'), max_length=255, blank=True, null=True)
remark=models.CharField(_('Status'), max_length=255, blank=True, null=True)
facility=models.CharField(_('Facility'), max_length=255, blank=True, null=True)
remark=models.CharField(_('Remarks'), max_length=255, blank=True, null=True)
tags=models.CharField(_('Tags'), max_length=512, blank=True, null=True)
parammeters=models.CharField(_('Parameters'), max_length=512, blank=True, null=True)
created_at=models.DateTimeField(auto_now_add=True)
@ -101,13 +101,13 @@ class Location_line(models.Model):
videos=models.CharField(_('Videos'), max_length=255, blank=True, null=True)
webcontents=models.CharField(_('Web Content'), max_length=255, blank=True, null=True)
status=models.CharField(_('Status'),max_length=255, blank=True, null=True)
portal=models.CharField(_('Status'), max_length=255,blank=True, null=True)
group=models.CharField(_('Status'), max_length=255,blank=True, null=True)
phone=models.CharField(_('Status'), max_length=255,blank=True, null=True)
fax=models.CharField(_('Status'), max_length=255, blank=True, null=True)
portal=models.CharField(_('Portal'), max_length=255,blank=True, null=True)
group=models.CharField(_('Group'), max_length=255,blank=True, null=True)
phone=models.CharField(_('Phone'), max_length=255,blank=True, null=True)
fax=models.CharField(_('Fax'), max_length=255, blank=True, null=True)
email=models.EmailField(_('Email'), max_length=255,blank=True, null=True)
facility=models.CharField(_('Status'), max_length=255, blank=True, null=True)
remark=models.CharField(_('Status'), max_length=255, blank=True, null=True)
facility=models.CharField(_('Facility'), max_length=255, blank=True, null=True)
remark=models.CharField(_('Remarks'), max_length=255, blank=True, null=True)
tags=models.CharField(_('Tags'), max_length=512, blank=True, null=True)
parammeters=models.CharField(_('Parameters'), max_length=512, blank=True, null=True)
created_at=models.DateTimeField(auto_now_add=True)
@ -133,13 +133,13 @@ class Location_polygon(models.Model):
videos=models.CharField(_('Videos'), max_length=255, blank=True, null=True)
webcontents=models.CharField(_('Web Content'), max_length=255, blank=True, null=True)
status=models.CharField(_('Status'),max_length=255, blank=True, null=True)
portal=models.CharField(_('Status'), max_length=255,blank=True, null=True)
group=models.CharField(_('Status'), max_length=255,blank=True, null=True)
phone=models.CharField(_('Status'), max_length=255,blank=True, null=True)
fax=models.CharField(_('Status'), max_length=255, blank=True, null=True)
portal=models.CharField(_('Portal'), max_length=255,blank=True, null=True)
group=models.CharField(_('Group'), max_length=255,blank=True, null=True)
phone=models.CharField(_('Phone'), max_length=255,blank=True, null=True)
fax=models.CharField(_('Fax'), max_length=255, blank=True, null=True)
email=models.EmailField(_('Email'), max_length=255,blank=True, null=True)
facility=models.CharField(_('Status'), max_length=255, blank=True, null=True)
remark=models.CharField(_('Status'), max_length=255, blank=True, null=True)
facility=models.CharField(_('Facility'), max_length=255, blank=True, null=True)
remark=models.CharField(_('Remarks'), max_length=255, blank=True, null=True)
tags=models.CharField(_('Tags'), max_length=512, blank=True, null=True)
parammeters=models.CharField(_('Parameters'), max_length=512, blank=True, null=True)
created_at=models.DateTimeField(auto_now_add=True)

View File

@ -1,9 +1,29 @@
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from sqlalchemy.sql.functions import mode
from .models import RogEvent, Shop, EventRoute, ShopRoute
from .models import RogEvent, Shop, EventRoute, ShopRoute, Location, Location_line, Location_polygon
from drf_extra_fields.fields import Base64ImageField
class LocationSerializer(GeoFeatureModelSerializer):
class Meta:
model=Location
geo_field='geom'
fields="__all__"
class Location_lineSerializer(GeoFeatureModelSerializer):
class Meta:
model=Location_line
geo_field='geom'
fields="__all__"
class Location_polygonSerializer(GeoFeatureModelSerializer):
class Meta:
model=Location_polygon
geo_field='geom'
fields="__all__"
class RogEventSerializer(GeoFeatureModelSerializer):
class Meta:
model=RogEvent

View File

@ -1,11 +1,15 @@
from rest_framework import urlpatterns
from rest_framework.routers import DefaultRouter
from .views import RogEventViewSet, EventRouteViewSet, ShopViewSet, ShopRouteViewSet
from .views import RogEventViewSet, EventRouteViewSet, ShopViewSet, ShopRouteViewSet, LocationViewSet, Location_lineViewSet, Location_polygonViewSet
from django.urls import path, include
router = DefaultRouter()
router.register(prefix='location', viewset=LocationViewSet, basename='location')
router.register(prefix='location_line', viewset=Location_lineViewSet, basename="location_line")
router.register(prefix='location_polygon', viewset=Location_polygonViewSet, basename='location_polygon')
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')

View File

@ -1,13 +1,27 @@
from django.core.serializers import serialize
from .models import RogEvent, ShopRoute, EventRoute, Shop
from .models import RogEvent, ShopRoute, EventRoute, Shop, Location, Location_line, Location_polygon
from rest_framework import viewsets
from .serializers import RogEventSerializer, EventRouteSerializer, ShopSerializer, ShopRouteSerializer
from .serializers import RogEventSerializer, EventRouteSerializer, ShopSerializer, ShopRouteSerializer, LocationSerializer, Location_lineSerializer, Location_polygonSerializer
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.parsers import JSONParser, MultiPartParser
class LocationViewSet(viewsets.ModelViewSet):
queryset=Location.objects.all()
serializer_class=LocationSerializer
class Location_lineViewSet(viewsets.ModelViewSet):
queryset=Location_line.objects.all()
serializer_class=Location_lineSerializer
class Location_polygonViewSet(viewsets.ModelViewSet):
queryset=Location_polygon.objects.all()
serializer_class=Location_polygonSerializer
class RogEventViewSet(viewsets.ModelViewSet):