Skip to content

Commit

Permalink
removes core api, adds matomo snippet (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
csae8092 authored Dec 2, 2024
1 parent f9db9c3 commit 6afbca4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 43 deletions.
2 changes: 0 additions & 2 deletions histogis/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.urls import path, include
from django.contrib import admin
from rest_framework import routers
from rest_framework.documentation import include_docs_urls
from vocabs import api_views
from shps import api_views as shps_api_views

Expand All @@ -24,7 +23,6 @@
shps_api_views.TemporalizedSpatialQuery.as_view(),
name="where_was_api",
),
path("api-docs/", include_docs_urls(title="HistoGIS-API")),
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
path("admin/", admin.site.urls),
path("vocabs/", include("vocabs.urls", namespace="vocabs")),
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Django>=5.0.6,<6
djangorestframework-gis
geopandas
psycopg2-binary
coreapi
lxml
rdflib
requests
Expand Down
39 changes: 0 additions & 39 deletions shps/api_views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import coreapi
import coreschema
from dateutil.parser import parse
from django.contrib.gis.geos import Point
from django_filters.rest_framework import DjangoFilterBackend

from rest_framework.schemas import AutoSchema
from rest_framework import generics
from rest_framework import viewsets
from rest_framework.filters import OrderingFilter
Expand Down Expand Up @@ -69,42 +66,6 @@ class TemporalizedSpatialQuery(generics.ListAPIView):

serializer_class = TempSpatialSerializer
pagination_class = StandardResultsSetPagination
schema = AutoSchema(
manual_fields=[
coreapi.Field(
"page_size",
required=False,
location="query",
schema=coreschema.String(
description="Defaults to 1 due to performance reasons."
),
),
coreapi.Field(
"lat",
required=True,
location="query",
schema=coreschema.String(
description="Latitude of the place to query for."
),
),
coreapi.Field(
name="lng",
required=True,
location="query",
schema=coreschema.String(
description="Longitude of the place to query for."
),
),
coreapi.Field(
"when",
required=False,
location="query",
schema=coreschema.String(
description="Date the TempSpatial temporal extent has to contain."
),
),
]
)

def get_queryset(self):
lat = self.request.query_params.get("lat", None)
Expand Down
16 changes: 16 additions & 0 deletions webpage/templates/webpage/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@
href="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.css"
/>
<link rel="stylesheet" href="{% static 'webpage/css/style.css' %}" />
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://matomo.acdh.oeaw.ac.at/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '87']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->

2 changes: 1 addition & 1 deletion webpage/templates/webpage/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
Data
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="/api-docs/">API-Docs</a></li>
<li><a class="dropdown-item disabled" href="/api-docs/" aria-disabled="true">API-Docs</a></li>
<li><a class="dropdown-item" href="/api/">API</a></li>
</ul>
</li>
Expand Down

0 comments on commit 6afbca4

Please sign in to comment.