Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: drop apis_vocabularies.models.TextType #502

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -137,20 +137,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 @@ -110,22 +109,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 @@ -10,7 +10,6 @@
],
"apis_vocabularies": [
"CollectionType",
"TextType",
"VocabNames",
"VocabsBaseClass",
"VocabsUri",
Expand Down
Loading