Skip to content

Commit

Permalink
refactor(apis_vocabularies)!: drop apis_vocabularies
Browse files Browse the repository at this point in the history
the apis_vocabularies app was removed- it is not being used right now
and it will be reindtroduced in #441.

BREAKING CHANGE: projects will have to remove
`apis_core.apis_vocabularies` from the list of INSTALLED_APPS

Closes: #514
  • Loading branch information
b1rger committed Dec 20, 2023
1 parent 59ed073 commit 85d7113
Show file tree
Hide file tree
Showing 20 changed files with 0 additions and 884 deletions.
45 changes: 0 additions & 45 deletions apis_core/apis_entities/autocomplete3.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from django.db.models import Q

from apis_core.apis_metainfo.models import Uri, Collection
from apis_core.apis_vocabularies.models import VocabsBaseClass
from apis_core.utils import caching
from apis_core.utils.caching import get_autocomplete_property_choices
from apis_core.utils.settings import get_entity_settings_by_modelname
Expand Down Expand Up @@ -377,50 +376,6 @@ def get(self, request, *args, **kwargs):
)


# TODO RDF: Check if this should be removed or adapted
class GenericVocabulariesAutocomplete(autocomplete.Select2ListView):
def get(self, request, *args, **kwargs):
page_size = 20
offset = (int(self.request.GET.get("page", 1)) - 1) * page_size
more = False
vocab = self.kwargs["vocab"]
direct = self.kwargs["direct"]
q = self.q
vocab_model = ContentType.objects.get(
app_label="apis_vocabularies", model=vocab
).model_class()
if direct == "normal":
if vocab_model.__bases__[0] == VocabsBaseClass:
choices = [
{"id": x.pk, "text": x.label}
for x in vocab_model.objects.filter(name__icontains=q).order_by(
"parent_class__name", "name"
)[offset : offset + page_size]
]
else:
choices = [
{"id": x.pk, "text": x.label}
for x in vocab_model.objects.filter(
Q(name__icontains=q) | Q(name_reverse__icontains=q)
).order_by("parent_class__name", "name")[
offset : offset + page_size
]
]
elif direct == "reverse":
choices = [
{"id": x.pk, "text": x.label_reverse}
for x in vocab_model.objects.filter(
Q(name__icontains=q) | Q(name_reverse__icontains=q)
).order_by("parent_class__name", "name")[offset : offset + page_size]
]
if len(choices) == page_size:
more = True
return http.HttpResponse(
json.dumps({"results": choices + [], "pagination": {"more": more}}),
content_type="application/json",
)


# TODO RDF: Check if this should be removed or adapted
class GenericNetworkEntitiesAutocomplete(autocomplete.Select2ListView):
def get(self, request, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class Migration(migrations.Migration):

dependencies = [
("apis_metainfo", "0001_initial"),
("apis_vocabularies", "0001_initial"),
("auth", "0012_alter_user_first_name_max_length"),
("contenttypes", "0002_remove_content_type_name"),
]
Expand Down
5 changes: 0 additions & 5 deletions apis_core/apis_metainfo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,8 @@ def duplicate(self):
class Collection(models.Model):
"""Allows to group entities and relation."""

from apis_core.apis_vocabularies.models import CollectionType

name = models.CharField(max_length=255)
description = models.TextField(blank=True)
collection_type = models.ForeignKey(
CollectionType, blank=True, null=True, on_delete=models.SET_NULL
)
groups_allowed = models.ManyToManyField(Group)
parent_class = models.ForeignKey(
"self", blank=True, null=True, on_delete=models.CASCADE
Expand Down
Empty file.
75 changes: 0 additions & 75 deletions apis_core/apis_vocabularies/admin.py

This file was deleted.

102 changes: 0 additions & 102 deletions apis_core/apis_vocabularies/api_renderers.py

This file was deleted.

6 changes: 0 additions & 6 deletions apis_core/apis_vocabularies/apps.py

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 85d7113

Please sign in to comment.