diff --git a/pyproject.toml b/pyproject.toml index c7852b4bd..76dfa8019 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -315,9 +315,10 @@ django-import-export = { git = "https://github.com/mpasternak/django-import-expo # commita gałęzi feat/error-record, żeby CI/lokalnie rozwiązać zależność. # USUŃ po wydaniu pbn-client 0.2.1 na PyPI (wtedy sam pin >=0.2.1,<0.3 wystarczy). pbn-client = { git = "https://github.com/iplweb/pbn-client.git", rev = "84503cf41b308bc86edc6f8709b71383a8676cac" } -# TYMCZASOWO: django-pbn-client 0.2.1 (sync_dictionary, D3) nie jest jeszcze na -# PyPI. Pin do commita gałęzi feat/sync-dictionary. USUŃ po wydaniu 0.2.1. -django-pbn-client = { git = "https://github.com/iplweb/django-pbn-client.git", rev = "9b2164f889861db9292b91508debf0732211bb39" } +# TYMCZASOWO: django-pbn-client 0.2.2 (sync_dictionary D3 + with_deleted_marker +# A2) nie jest jeszcze na PyPI. Pin do commita gałęzi feat/deleted-marker +# (stacked na feat/sync-dictionary). USUŃ po wydaniu 0.2.2 na PyPI. +django-pbn-client = { git = "https://github.com/iplweb/django-pbn-client.git", rev = "bb952e98967a96f96cd3773e3dcfcaf4555c8690" } # Konfiguracja `pytest-testcontainers-django` — pluginu pytest, ktory # startuje kontenery PG/Redis przed importem Django settings i wstrzykuje diff --git a/src/bpp/newsfragments/pbn-a2-deleted-marker.feature.rst b/src/bpp/newsfragments/pbn-a2-deleted-marker.feature.rst new file mode 100644 index 000000000..1a1aa6179 --- /dev/null +++ b/src/bpp/newsfragments/pbn-a2-deleted-marker.feature.rst @@ -0,0 +1,4 @@ +Marker „[❌ USUNIĘTY]" w reprezentacji tekstowej lustrzanych obiektów PBN +(instytucje, publikacje, konferencje, wydawcy, czasopisma, naukowcy) korzysta +teraz ze wspólnego helpera ``with_deleted_marker`` z pakietu +``django-pbn-client`` — koniec sześciu zduplikowanych bloków ``if is_deleted``. diff --git a/src/pbn_api/models/conference.py b/src/pbn_api/models/conference.py index b93704120..2b3e8815d 100644 --- a/src/pbn_api/models/conference.py +++ b/src/pbn_api/models/conference.py @@ -23,6 +23,4 @@ def country(self): def __str__(self): ret = f"{self.fullName()}, {self.startDate()}, {self.city()}" - if self.is_deleted: - ret = f"[❌ USUNIĘTY] {ret}" - return ret + return self.with_deleted_marker(ret) diff --git a/src/pbn_api/models/institution.py b/src/pbn_api/models/institution.py index c37621a69..d95c15bc1 100644 --- a/src/pbn_api/models/institution.py +++ b/src/pbn_api/models/institution.py @@ -53,9 +53,7 @@ def __str__(self): while ret.find(",,") != -1: ret = ret.replace(",,", ",") ret = ret.replace(", (", " (") - if self.is_deleted: - ret = f"[❌ USUNIĘTY] {ret}" - return ret + return self.with_deleted_marker(ret) @cached_property def rekord_w_bpp(self): diff --git a/src/pbn_api/models/journal.py b/src/pbn_api/models/journal.py index 688acf961..d0703a55b 100644 --- a/src/pbn_api/models/journal.py +++ b/src/pbn_api/models/journal.py @@ -27,9 +27,7 @@ def __str__(self): f"{self.title}, ISSN: {self.issn or '-'}, " f"EISSN: {self.eissn or '-'}, MNISW ID: {self.mniswId or '-'}" ) - if self.is_deleted: - ret = f"[❌ USUNIĘTY] {ret}" - return ret + return self.with_deleted_marker(ret) def rekord_w_bpp(self): from bpp.models import Zrodlo diff --git a/src/pbn_api/models/publication.py b/src/pbn_api/models/publication.py index 334869f84..e624e7fb0 100644 --- a/src/pbn_api/models/publication.py +++ b/src/pbn_api/models/publication.py @@ -187,6 +187,4 @@ def __str__(self): ret += f", {self.year}" if self.doi: ret += f", {self.doi}" - if self.is_deleted: - ret = f"[❌ USUNIĘTY] {ret}" - return ret + return self.with_deleted_marker(ret) diff --git a/src/pbn_api/models/publisher.py b/src/pbn_api/models/publisher.py index 45da6c02a..185a74bc2 100644 --- a/src/pbn_api/models/publisher.py +++ b/src/pbn_api/models/publisher.py @@ -30,9 +30,7 @@ class Meta: def __str__(self): ret = f"{self.publisherName}, MNISW ID: {self.mniswId or '-'}" - if self.is_deleted: - ret = f"[❌ USUNIĘTY] {ret}" - return ret + return self.with_deleted_marker(ret) @property def points(self): diff --git a/src/pbn_api/models/scientist.py b/src/pbn_api/models/scientist.py index 0b871a784..c7064f199 100644 --- a/src/pbn_api/models/scientist.py +++ b/src/pbn_api/models/scientist.py @@ -63,9 +63,7 @@ def __str__(self): ret = ret.replace(" ,", ",") ret = ret.replace("-, ", "") ret = ret.replace(", (", " (") - if self.is_deleted: - ret = f"[❌ USUNIĘTY] {ret}" - return ret + return self.with_deleted_marker(ret) @cached_property def rekord_w_bpp(self): diff --git a/uv.lock b/uv.lock index 8e7c77eea..4a838feb5 100644 --- a/uv.lock +++ b/uv.lock @@ -615,7 +615,7 @@ requires-dist = [ { name = "django-multiseek", specifier = "==0.10.2" }, { name = "django-oauth-toolkit", specifier = "==3.3.0" }, { name = "django-password-policies-iplweb", specifier = "==0.9.0" }, - { name = "django-pbn-client", git = "https://github.com/iplweb/django-pbn-client.git?rev=9b2164f889861db9292b91508debf0732211bb39" }, + { name = "django-pbn-client", git = "https://github.com/iplweb/django-pbn-client.git?rev=bb952e98967a96f96cd3773e3dcfcaf4555c8690" }, { name = "django-pg-baseline", specifier = ">=0.3.0" }, { name = "django-polish-inflection", specifier = ">=0.1,<0.2" }, { name = "django-prometheus", specifier = ">=2.5.0" }, @@ -2104,8 +2104,8 @@ wheels = [ [[package]] name = "django-pbn-client" -version = "0.2.1" -source = { git = "https://github.com/iplweb/django-pbn-client.git?rev=9b2164f889861db9292b91508debf0732211bb39#9b2164f889861db9292b91508debf0732211bb39" } +version = "0.2.2" +source = { git = "https://github.com/iplweb/django-pbn-client.git?rev=bb952e98967a96f96cd3773e3dcfcaf4555c8690#bb952e98967a96f96cd3773e3dcfcaf4555c8690" } dependencies = [ { name = "django", marker = "platform_python_implementation != 'PyPy'" }, { name = "pbn-client", marker = "platform_python_implementation != 'PyPy'" },