Skip to content

Commit

Permalink
refactor!: drop apis_vocabularies.models.TextType
Browse files Browse the repository at this point in the history
Given that we removed `Text` in 063412f
we don't need `TextType` anymore either.

Closes: #499
  • Loading branch information
b1rger committed Dec 15, 2023
1 parent 13088b6 commit 422d220
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 48 deletions.
12 changes: 0 additions & 12 deletions apis_core/apis_entities/edit_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from apis_core.apis_relations.tables import get_generic_triple_table
from .forms import get_entities_form, GenericEntitiesStanbolForm
from .views import set_session_variables
from ..apis_vocabularies.models import TextType
from apis_core.utils import helpers
from apis_core.utils.settings import get_entity_settings_by_modelname
from apis_core.apis_entities.mixins import EntityMixin, EntityInstanceMixin
Expand Down Expand Up @@ -84,17 +83,6 @@ def get(self, request, *args, **kwargs):
form = form(instance=self.instance)
if "apis_bibsonomy" in settings.INSTALLED_APPS:
apis_bibsonomy = getattr(settings, "APIS_BIBSONOMY_FIELDS", [])
apis_bibsonomy_texts = getattr(settings, "APIS_BIBSONOMY_TEXTS", False)
if apis_bibsonomy_texts:
apis_bibsonomy.extend(
[
f"text_{self.pk}"
for pk in TextType.objects.filter(
name__in=apis_bibsonomy_texts
).values_list("pk", flat=True)
if f"text_{self.pk}" not in apis_bibsonomy
]
)
if isinstance(apis_bibsonomy, list):
apis_bibsonomy = "|".join([x.strip() for x in apis_bibsonomy])
else:
Expand Down
1 change: 0 additions & 1 deletion apis_core/apis_entities/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from django.urls import reverse

from apis_core.apis_metainfo.models import Uri, Collection
from apis_core.apis_vocabularies.models import TextType
from apis_core.utils import DateParser, caching, settings as apis_settings
from apis_core.utils.settings import get_entity_settings_by_modelname
from .fields import ListSelect2, Select2Multiple
Expand Down
17 changes: 0 additions & 17 deletions apis_core/apis_vocabularies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,3 @@ class CollectionType(VocabsBaseClass):
"""e.g. reseachCollection, importCollection"""

pass


# TODO RDF: Remove this
@reversion.register(follow=["vocabsbaseclass_ptr"])
class TextType(VocabsBaseClass):
"""used to store the Text types for the forms"""

entity = models.CharField(max_length=255)
collections = models.ManyToManyField("apis_metainfo.Collection", blank=True)
lang = models.CharField(
max_length=3,
blank=True,
null=True,
help_text="The ISO 639-3 (or 2) code for the label's language.",
verbose_name="ISO Code",
default="deu",
)
17 changes: 0 additions & 17 deletions apis_core/apis_vocabularies/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from rest_framework import serializers

from .models import (
TextType,
CollectionType,
VocabsBaseClass,
VocabNames,
Expand Down Expand Up @@ -111,22 +110,6 @@ class Meta:
###########################################################


class TextTypeSerializer(VocabsBaseSerializer):
url = serializers.HyperlinkedIdentityField(
view_name="apis:apis_api:texttype-detail", lookup_field="pk"
)
collections = serializers.HyperlinkedRelatedField(
view_name="apis:apis_api:collection-detail",
lookup_field="pk",
many=True,
read_only=True,
)

class Meta:
fields = "__all__"
model = TextType


# TODO RDF: Check if this should be removed or adapted
#
# class InstitutionTypeSerializer(VocabsBaseSerializer):
Expand Down
1 change: 0 additions & 1 deletion apis_core/utils/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"apis_vocabularies": [
"CollectionType",
"LabelType",
"TextType",
"VocabNames",
"VocabsBaseClass",
"VocabsUri",
Expand Down

0 comments on commit 422d220

Please sign in to comment.