Add points of interest
Do a bunch of refactoring in the process. Current display on homepage is a little shonky but that can be improved when there is something using it.
This commit is contained in:
@ -23,7 +23,7 @@ from rest_framework import routers, serializers, viewsets
|
||||
from rest_framework_gis import serializers as gis_serializers
|
||||
|
||||
from apps.files.models import File
|
||||
from apps.map.models import CaseStudy
|
||||
from apps.map.models import CaseStudy, PointOfInterest
|
||||
|
||||
from .views import LanguageDropdownView
|
||||
|
||||
@ -71,9 +71,28 @@ class CaseStudyViewSet(viewsets.ModelViewSet):
|
||||
serializer_class = CaseStudySerializer
|
||||
|
||||
|
||||
|
||||
class PointOfInterestSerializer(gis_serializers.GeoFeatureModelSerializer):
|
||||
class Meta:
|
||||
model = PointOfInterest
|
||||
geo_field = "location"
|
||||
fields = (
|
||||
'title',
|
||||
'synopsis',
|
||||
'link',
|
||||
'slug'
|
||||
)
|
||||
|
||||
|
||||
class PointOfInterestViewSet(viewsets.ModelViewSet):
|
||||
queryset = PointOfInterest.objects.approved()
|
||||
serializer_class = PointOfInterestSerializer
|
||||
|
||||
|
||||
apirouter = routers.DefaultRouter()
|
||||
#apirouter.register(r'users', UserViewSet)
|
||||
apirouter.register(r'case-studies', CaseStudyViewSet)
|
||||
apirouter.register(r'points-of-interest', PointOfInterestViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'api/', include(apirouter.urls)),
|
||||
|
||||
Reference in New Issue
Block a user