diff --git a/apis_core/apis_entities/forms.py b/apis_core/apis_entities/forms.py index a94b183e6..85b11f5a0 100644 --- a/apis_core/apis_entities/forms.py +++ b/apis_core/apis_entities/forms.py @@ -8,8 +8,8 @@ from django.core.validators import URLValidator from django.urls import reverse -from apis_core.apis_metainfo.models import Uri, Collection -from apis_core.utils import DateParser, caching, settings as apis_settings +from apis_core.apis_metainfo.models import Uri +from apis_core.utils import caching, settings as apis_settings from apis_core.utils.settings import get_entity_settings_by_modelname from .fields import ListSelect2 diff --git a/apis_core/apis_entities/models.py b/apis_core/apis_entities/models.py index f37c97188..8a0ce0e70 100644 --- a/apis_core/apis_entities/models.py +++ b/apis_core/apis_entities/models.py @@ -1,19 +1,14 @@ import re -import unicodedata from django.contrib.contenttypes.models import ContentType -import reversion from django.conf import settings from django.contrib.auth.models import Group -from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver from django.urls import reverse -from model_utils.managers import InheritanceManager from django.db.models.query import QuerySet from apis_core.utils import caching -from apis_core.utils import DateParser from apis_core.apis_metainfo.models import RootObject from apis_core.apis_relations.models import TempTriple from apis_core.apis_entities import signals diff --git a/apis_core/apis_metainfo/models.py b/apis_core/apis_metainfo/models.py index 647ab085a..1c638ad83 100644 --- a/apis_core/apis_metainfo/models.py +++ b/apis_core/apis_metainfo/models.py @@ -207,7 +207,7 @@ def clean(self): self.root_object = obj else: raise ImproperlyConfigured( - f"{uri}: found model <{model}> and attributes <{attributes}>" + f"{self.uri}: found model <{model}> and attributes <{attributes}>" ) except Exception as e: raise ValidationError(f"{e}: {self.uri}") diff --git a/apis_core/apis_relations/rel_filters.py b/apis_core/apis_relations/rel_filters.py index 8cda73ca1..2ec977dc4 100644 --- a/apis_core/apis_relations/rel_filters.py +++ b/apis_core/apis_relations/rel_filters.py @@ -1,6 +1,3 @@ -import operator -from functools import reduce - import django_filters from dal import autocomplete from django.conf import settings @@ -93,8 +90,6 @@ def get_filters(model, exclude=False, include=False, include_parents=False): def get_generic_relation_filter(entity): class GenericListFilter(django_filters.FilterSet): - # search = django_filters.CharFilter(method='search_filter_method') - def name_label_filter(self, queryset, name, value): """ Filter for including the alternative names in the names search.\ @@ -156,15 +151,6 @@ def wildcard_filter(self, queryset, name, value): f += "exact" return queryset.filter(**{f: value}) - def search_filter_method(self, queryset, name, value): - cls = queryset.model.__name__ - sett_filters = getattr(settings, "APIS_RELATIONS", {}) - if cls.lower() in sett_filters.keys(): - filter_attr = sett_filters[cls.lower()].get("search", ["name"]) - query = reduce( - operator.or_, [Q(**{attr: value}) for attr in filter_attr] - ) - class Meta: # model = AbstractRelation.get_relation_class_of_name(entity) model = None diff --git a/apis_core/utils/helpers.py b/apis_core/utils/helpers.py index a731f7a55..31a922556 100644 --- a/apis_core/utils/helpers.py +++ b/apis_core/utils/helpers.py @@ -3,7 +3,6 @@ import inspect import itertools import logging -from typing import Type from apis_core.apis_relations.models import Property, TempTriple