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:
@ -127,7 +127,8 @@
|
||||
{# CDN Javascript #}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0=" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
<script src="{% static "map/language.js" %}"></script>
|
||||
<script src="{% url 'javascript-catalogue' %}"></script>
|
||||
<script src="{% static 'map/language.js' %}"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
|
||||
</html>
|
||||
|
@ -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