Skip to content

Commit

Permalink
chore(deps): bump apis-core-rdf to v0.24.0
Browse files Browse the repository at this point in the history
... and adapt the filtersets, to override the new default `search`.
Also use the new `_default_search_fields` attribute for models.
  • Loading branch information
b1rger committed Aug 19, 2024
1 parent abe04a7 commit 493a56a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
26 changes: 12 additions & 14 deletions apis_ontology/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,35 +81,33 @@ class PersonFilterSet(LegacyStuffMixinFilterSet):
label="Collections",
method=collection_method,
)
search = django_filters.CharFilter(
method=trigram_search_filter_person,
label="Search",
help_text=PERSON_HELP_TEXT)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.filters.move_to_end("forename", False)
self.filters.move_to_end("collection", False)
self.filters.move_to_end("search", False)
self.filters["search"] = django_filters.CharFilter(
method=trigram_search_filter_person,
label="Search",
help_text=PERSON_HELP_TEXT)


class InstitutionFilterSet(LegacyStuffMixinFilterSet):
search = django_filters.CharFilter(
method=trigram_search_filter_institution,
label="Search",
help_text=HELP_TEXT)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.filters.move_to_end("search", False)
self.filters["search"] = django_filters.CharFilter(
method=trigram_search_filter_institution,
label="Search",
help_text=HELP_TEXT)


class PlaceFilterSet(LegacyStuffMixinFilterSet):
search = django_filters.CharFilter(
method=trigram_search_filter_place,
label="Search",
help_text=HELP_TEXT)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.filters.move_to_end("search", False)
self.filters["search"] = django_filters.CharFilter(
method=trigram_search_filter_place,
label="Search",
help_text=HELP_TEXT)
4 changes: 4 additions & 0 deletions apis_ontology/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class Event(LegacyStuffMixin, VersionMixin, LegacyDateMixin, AbstractEntity):
name = models.CharField(max_length=255, verbose_name="Name", blank=True)
notes = models.TextField(blank=True, null=True, verbose_name=_("Notes"))

_default_search_fields = ["name", "notes", "kind"]

def __str__(self):
return self.name

Expand Down Expand Up @@ -217,6 +219,8 @@ class Work(LegacyStuffMixin, VersionMixin, LegacyDateMixin, AbstractEntity):
name = models.CharField(max_length=255, verbose_name="Name", blank=True)
notes = models.TextField(blank=True, null=True, verbose_name=_("Notes"))

_default_search_fields = ["name", "notes", "kind"]

def __str__(self):
return self.name

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages = [{include = "apis_ontology"}]
[tool.poetry.dependencies]
python = "^3.11"
psycopg2 = "^2.9"
apis-core = {git = "https://github.com/acdh-oeaw/apis-core-rdf", rev = "v0.23.2"}
apis-core = {git = "https://github.com/acdh-oeaw/apis-core-rdf", rev = "v0.24.0"}
apis-highlighter-ng = "^0.4.0"
apis-acdhch-default-settings = "1.0.0"
django-acdhch-functions = "^0.1.3"
Expand Down

0 comments on commit 493a56a

Please sign in to comment.