Skip to content

Commit

Permalink
Merge pull request #193 from acdh-oeaw/192-remove-stelleort
Browse files Browse the repository at this point in the history
192 remove stelleort
  • Loading branch information
csae8092 authored Jan 16, 2023
2 parents 8734043 + 69743d0 commit 0ef107d
Show file tree
Hide file tree
Showing 8 changed files with 29,790 additions and 5,339 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Test
on:
on:
push:
branches:
- master

jobs:
test:
Expand Down
124 changes: 50 additions & 74 deletions archiv/api_serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# API serializers for archiv created by appcreator
from rest_framework import serializers
from rest_framework_gis.serializers import GeoFeatureModelSerializer, GeometrySerializerMethodField
from rest_framework_gis.serializers import (
GeoFeatureModelSerializer,
GeometrySerializerMethodField,
)
from archiv.models import (
Autor,
KeyWord,
Expand All @@ -9,61 +12,53 @@
Text,
SpatialCoverage,
UseCase,
Event
Event,
)
from story_map.models import Story, Slide


class EventSerializer(serializers.ModelSerializer):

class Meta:
model = Event
fields = "__all__"
depth = 0


class StorySerializer(serializers.ModelSerializer):

class Meta:
model = Story
fields = "__all__"
depth = 2


class SlideSerializer(serializers.ModelSerializer):

class Meta:
model = Slide
fields = "__all__"
depth = 1


class UseCaseSerializer(serializers.ModelSerializer):

class Meta:
model = UseCase
fields = "__all__"
depth = 1


class SpatialCoverageSerializer(
GeoFeatureModelSerializer, serializers.ModelSerializer
):
class SpatialCoverageSerializer(GeoFeatureModelSerializer, serializers.ModelSerializer):
stelle = serializers.ReadOnlyField(source="stellen")
texts = serializers.ReadOnlyField()
places = serializers.ReadOnlyField()

class Meta:
model = SpatialCoverage
geo_field = 'fuzzy_geom'
geo_field = "fuzzy_geom"
auto_bbox = True
fields = (
'id',
'key_word',
'fuzzyness',
'stelle',
'texts',
'places'
"id",
"key_word",
"fuzzyness",
"stelle",
"texts",
)
depth = 1

Expand All @@ -73,135 +68,116 @@ class SpatialCoverageGroupSerializer(
):
stelle = serializers.ReadOnlyField(source="stellen")
texts = serializers.ReadOnlyField()
places = serializers.ReadOnlyField()

class Meta:
model = SpatialCoverage
geo_field = 'geom_collection'
geo_field = "geom_collection"
auto_bbox = True
fields = (
'id',
'key_word',
'fuzzyness',
'stelle',
'texts',
'places'
"id",
"key_word",
"fuzzyness",
"stelle",
"texts",
)
depth = 1


class ConeSerializer(
GeoFeatureModelSerializer, serializers.ModelSerializer
):
class ConeSerializer(GeoFeatureModelSerializer, serializers.ModelSerializer):
cone = GeometrySerializerMethodField()
stelle = serializers.ReadOnlyField(source="stellen")
texts = serializers.ReadOnlyField()
places = serializers.ReadOnlyField()

def get_cone(self, res):
return res.convex_hull

class Meta:
model = SpatialCoverage
geo_field = 'cone'
geo_field = "cone"
auto_bbox = False
fields = (
'id',
'key_word',
'fuzzyness',
'stelle',
'texts',
'places'
"id",
"key_word",
"fuzzyness",
"stelle",
"texts",
)
depth = 1


class AutorSerializer(serializers.ModelSerializer):

class Meta:
model = Autor
exclude = [
"legacy_id",
"legacy_pk",
"orig_data_csv"
]
exclude = ["legacy_id", "legacy_pk", "orig_data_csv"]
depth = 1


class KeyWordSerializer(serializers.ModelSerializer):

class Meta:
model = KeyWord
exclude = [
"legacy_id",
"legacy_pk",
"orig_data_csv"
]
exclude = ["legacy_id", "legacy_pk", "orig_data_csv"]


class OrtSerializer(serializers.ModelSerializer):

class Meta:
model = Ort
exclude = [
"legacy_id",
"legacy_pk",
"orig_data_csv"
]
exclude = ["legacy_id", "legacy_pk", "orig_data_csv"]


class GeoJsonOrtSerializer(
GeoFeatureModelSerializer, serializers.ModelSerializer
):
class GeoJsonOrtSerializer(GeoFeatureModelSerializer, serializers.ModelSerializer):

art = serializers.ReadOnlyField(source="kind")

class Meta:
model = Ort
geo_field = 'coords'
geo_field = "coords"
fields = [
'id', 'name', 'name_antik', 'name_de',
'name_fr', 'name_gr', 'art', 'kategorie'
"id",
"name",
"name_antik",
"name_de",
"name_fr",
"name_gr",
"art",
"kategorie",
]
depth = 0


class FuzzyGeoJsonOrtSerializer(
GeoFeatureModelSerializer, serializers.ModelSerializer
):
class FuzzyGeoJsonOrtSerializer(GeoFeatureModelSerializer, serializers.ModelSerializer):

art = serializers.ReadOnlyField(source="kind")

class Meta:
model = Ort
geo_field = 'fuzzy_geom'
geo_field = "fuzzy_geom"
fields = [
'id', 'name', 'name_antik', 'name_de',
'name_fr', 'name_gr', 'art', 'kategorie'
"id",
"name",
"name_antik",
"name_de",
"name_fr",
"name_gr",
"art",
"kategorie",
]
depth = 0


class StelleSerializer(serializers.ModelSerializer):

class Meta:
model = Stelle
exclude = [
"legacy_id",
"legacy_pk",
"orig_data_csv",
'lemmata',
"lemmata",
]
depth = 2


class TextSerializer(serializers.ModelSerializer):

class Meta:
model = Text
exclude = [
"legacy_id",
"legacy_pk",
"orig_data_csv"
]
exclude = ["legacy_id", "legacy_pk", "orig_data_csv"]
depth = 1
18 changes: 0 additions & 18 deletions archiv/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,6 @@ class SpatialCoverageListFilter(django_filters.FilterSet):
label="Related to any UseCase?",
help_text="Set 'Yes' to show only objects related to any UseCase",
)
stelle__ort = django_filters.ModelMultipleChoiceFilter(
conjoined=True,
queryset=Ort.objects.all(),
help_text="Place mentioned in Stelle",
label="Place mentioned in Stelle",
widget=autocomplete.Select2Multiple(
url="archiv-ac:ort-autocomplete",
),
)
stelle__text__ort = django_filters.ModelMultipleChoiceFilter(
conjoined=True,
queryset=Ort.objects.all(),
Expand Down Expand Up @@ -740,15 +731,6 @@ class StelleListFilter(django_filters.FilterSet):
url="/vocabs-ac/specific-concept-ac/art",
),
)
ort = django_filters.ModelMultipleChoiceFilter(
conjoined=True,
queryset=Ort.objects.all(),
help_text="Related Places",
label="Places",
widget=autocomplete.Select2Multiple(
url="archiv-ac:ort-autocomplete",
),
)
summary = django_filters.LookupChoiceFilter(
lookup_choices=CHAR_LOOKUP_CHOICES,
help_text=Stelle._meta.get_field("summary").help_text,
Expand Down
Loading

0 comments on commit 0ef107d

Please sign in to comment.