diff --git a/apis_core/apis_entities/detail_views.py b/apis_core/apis_entities/detail_views.py
index 104047c..ee3bb3a 100644
--- a/apis_core/apis_entities/detail_views.py
+++ b/apis_core/apis_entities/detail_views.py
@@ -37,7 +37,6 @@ def get(self, request, *args, **kwargs):
table = get_generic_relations_table(
relation_class=rel, entity_instance=instance, detail=True
)
- print(match, entity)
if match[0] == entity:
link_to_relations = f"{rel.get_listview_url()}?source={pk}"
rel_type = match[1]
diff --git a/apis_core/apis_entities/templates/apis_entities/confirm_delete.html b/apis_core/apis_entities/templates/apis_entities/confirm_delete.html
index a616931..31bf42a 100644
--- a/apis_core/apis_entities/templates/apis_entities/confirm_delete.html
+++ b/apis_core/apis_entities/templates/apis_entities/confirm_delete.html
@@ -9,10 +9,10 @@
Ganz sicher?
{% csrf_token %}
diff --git a/apis_core/apis_relations/models.py b/apis_core/apis_relations/models.py
index f10a251..4d70e18 100644
--- a/apis_core/apis_relations/models.py
+++ b/apis_core/apis_relations/models.py
@@ -337,6 +337,10 @@ def get_related_entity_field_nameb(cls):
class PersonPerson(AbstractRelation):
+ @classmethod
+ def get_icon(self):
+ return "bi bi-people apis-person"
+
@classmethod
def get_second_icon(self):
return "bi bi-people apis-person"
diff --git a/apis_core/apis_relations/person_event_relation_views.py b/apis_core/apis_relations/person_event_relation_views.py
index fd4eed9..84747aa 100644
--- a/apis_core/apis_relations/person_event_relation_views.py
+++ b/apis_core/apis_relations/person_event_relation_views.py
@@ -53,7 +53,7 @@ class PersonEventListView(GenericListView):
"target",
"crud",
]
- verbose_name = "Personen und Orte"
+ verbose_name = "Personen und Ereignisse"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
diff --git a/apis_core/apis_relations/person_institution_relation_views.py b/apis_core/apis_relations/person_institution_relation_views.py
index 6e93b91..ed650d1 100644
--- a/apis_core/apis_relations/person_institution_relation_views.py
+++ b/apis_core/apis_relations/person_institution_relation_views.py
@@ -55,7 +55,7 @@ class PersonInstitutionListView(GenericListView):
"target",
"crud",
]
- verbose_name = "Personen und Orte"
+ verbose_name = "Personen und Institutionen"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
diff --git a/apis_core/apis_relations/person_person_relation_views.py b/apis_core/apis_relations/person_person_relation_views.py
index ee3bb75..82b50a1 100644
--- a/apis_core/apis_relations/person_person_relation_views.py
+++ b/apis_core/apis_relations/person_person_relation_views.py
@@ -53,7 +53,7 @@ class PersonPersonListView(GenericListView):
"target",
"crud",
]
- verbose_name = "Personen und Orte"
+ verbose_name = "Personen und Personen"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
diff --git a/apis_core/apis_relations/person_work_relation_views.py b/apis_core/apis_relations/person_work_relation_views.py
index 36ec738..98b7fcf 100644
--- a/apis_core/apis_relations/person_work_relation_views.py
+++ b/apis_core/apis_relations/person_work_relation_views.py
@@ -53,7 +53,7 @@ class PersonWorkListView(GenericListView):
"target",
"crud",
]
- verbose_name = "Personen und Orte"
+ verbose_name = "Personen und Werke"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
diff --git a/apis_core/apis_relations/utils.py b/apis_core/apis_relations/utils.py
index abd5898..fe7e126 100644
--- a/apis_core/apis_relations/utils.py
+++ b/apis_core/apis_relations/utils.py
@@ -73,6 +73,7 @@ class MyTable(tables.Table):
class Meta:
model = MyModelClass
+ order_by = "-updated"
sequence = (
"id",
"source",
diff --git a/notebooks/issue_227_theatre_titles.ipynb b/notebooks/issue_227_theatre_titles.ipynb
new file mode 100644
index 0000000..67aa4f0
--- /dev/null
+++ b/notebooks/issue_227_theatre_titles.ipynb
@@ -0,0 +1,106 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "535b021a-300f-4140-96b6-5a50b96336bc",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# run against production 2024-10-16\n",
+ "from tqdm import tqdm\n",
+ "from dumper.utils import gsheet_to_df\n",
+ "from apis_core.utils import get_object_from_pk_or_uri"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "a914f665-cd8b-4698-8499-e4fb92c9f709",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = gsheet_to_df(\"1wgLHBHeJECkmgJUIpPdG-JS8F-0ht_LdVTxNmWwW8O0\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "08aefefc-762f-4400-9893-1043d69ca874",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "col, _ = Collection.objects.get_or_create(name=\"Schnitzler-Theater\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "d6e188f0-371b-4527-8df1-3758d8eeee85",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# don't run twice!!!\n",
+ "pmb_ids = []\n",
+ "for i, row in tqdm(df.iterrows()):\n",
+ " work = Work.objects.create(name=row[\"Title\"])\n",
+ " pmb_ids.append(work.id)\n",
+ " work.collection.add(col)\n",
+ " uri, _ = Uri.objects.get_or_create(\n",
+ " uri=f'https://{row[\"URI\"]}',\n",
+ " domain=\"schnitzler-theater\",\n",
+ " entity=work\n",
+ " )"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "a845af15-a476-4e16-a8c1-ed33d1c7da86",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df[\"pmb_ids\"] = pmb_ids"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b682fa0f-4b92-4f90-b2c8-53d0f9f332a0",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df.to_csv(\"theater-uris.csv\", index=False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "63d06a2d-bc85-4ae4-8142-a287f471a2fa",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Django Shell-Plus",
+ "language": "python",
+ "name": "django_extensions"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/notebooks/issue__213.ipynb b/notebooks/issue__213.ipynb
new file mode 100644
index 0000000..67df55f
--- /dev/null
+++ b/notebooks/issue__213.ipynb
@@ -0,0 +1,145 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "abdba1e8-027e-4931-a35b-03aaf8aa9464",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from django.core.exceptions import ObjectDoesNotExist\n",
+ "from tqdm import tqdm\n",
+ "from dumper.utils import gsheet_to_df\n",
+ "from apis_core.utils import get_object_from_pk_or_uri"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "cdb36196-46aa-4b7b-9871-0a8a3dd279ea",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = gsheet_to_df(\"1-_WXbdmpLzz_9vBiZ1y9v2tle_26m4tAhPTGzkkin5E\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "682d2d62-1e30-4db5-8323-c07a3f62222e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "342c4e3d-39c5-4f8b-b0b0-950cde457983",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "relation_type_lookup = {\n",
+ " \"1049\": {\n",
+ " \"relation_type\":PersonWork,\n",
+ " \"relation\": PersonWorkRelation.objects.get(id=1049),\n",
+ " \"target_class\": Work\n",
+ " },\n",
+ " \"1052\": {\n",
+ " \"relation_type\": PersonWork,\n",
+ " \"relation\": PersonWorkRelation.objects.get(id=1052),\n",
+ " \"target_class\": Work\n",
+ " },\n",
+ " \"1053\": {\n",
+ " \"relation_type\": PersonWork,\n",
+ " \"relation\": PersonWorkRelation.objects.get(id=1053),\n",
+ " \"target_class\": Work\n",
+ " },\n",
+ " \"1181\": {\n",
+ " \"relation_type\": PersonPlace,\n",
+ " \"relation\": PersonPlaceRelation.objects.get(id=1181),\n",
+ " \"target_class\": Place\n",
+ " },\n",
+ " \"1217\": {\n",
+ " \"relation_type\": PersonWork,\n",
+ " \"relation\": PersonWorkRelation.objects.get(id=1217),\n",
+ " \"target_class\": Work\n",
+ " }\n",
+ "}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "6748b522-2617-4436-ab9b-0c46c1867e6a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "does_not_exist = set()\n",
+ "for g, ndf in df.groupby(\"relation-id\"):\n",
+ " relation = relation_type_lookup[str(g)][\"relation\"]\n",
+ " relation_class = relation_type_lookup[str(g)][\"relation_type\"]\n",
+ " target_class = relation_type_lookup[str(g)][\"target_class\"]\n",
+ " print(relation, relation_class, target_class)\n",
+ " if \"ork\" in relation_class.__name__:\n",
+ " print(\"work\")\n",
+ " else:\n",
+ " print(\"place\")\n",
+ " for i, row in tqdm(ndf.iterrows(), total=len(ndf)):\n",
+ " try:\n",
+ " source = Person.objects.get(pk=row[\"source_id\"])\n",
+ " except ObjectDoesNotExist:\n",
+ " does_not_exist.add(row[\"source_id\"])\n",
+ " continue\n",
+ " try:\n",
+ " target = target_class.objects.get(pk=row[\"target_id\"])\n",
+ " except ObjectDoesNotExist:\n",
+ " does_not_exist.add(row[\"target_id\"])\n",
+ " if isinstance(row[\"relation_start_date_written\"], str):\n",
+ " start_date_written = row[\"relation_start_date_written\"]\n",
+ " end_date_written = row[\"relation_end_date_written\"]\n",
+ " else:\n",
+ " start_date_written = None\n",
+ " end_date_written = None\n",
+ " if \"ork\" in relation_class.__name__:\n",
+ " relation_class.objects.get_or_create(\n",
+ " related_person=source,\n",
+ " related_work=target,\n",
+ " relation_type=relation,\n",
+ " start_date_written=start_date_written,\n",
+ " end_date_written=end_date_written\n",
+ " )\n",
+ " else:\n",
+ " relation_class.objects.get_or_create(\n",
+ " related_person=source,\n",
+ " related_place=target,\n",
+ " relation_type=relation,\n",
+ " start_date_written=start_date_written,\n",
+ " end_date_written=end_date_written\n",
+ " )\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Django Shell-Plus",
+ "language": "python",
+ "name": "django_extensions"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/templates/partials/navbar.html b/templates/partials/navbar.html
index 9913826..9e0a00e 100644
--- a/templates/partials/navbar.html
+++ b/templates/partials/navbar.html
@@ -79,37 +79,36 @@
- Personen und Personen
-
+ Personen und Personen
- Personen und Orte
-
+ Personen und Orte
+
- Personen und Werke
-
+ Personen und Werke
+
- Personen und Events
-
+ Personen und Events
+
- Personen und Institutionen
-
+ Personen und Institutionen
+