Skip to content

Commit

Permalink
Merge pull request #65 from arthur-schnitzler/main
Browse files Browse the repository at this point in the history
updates
  • Loading branch information
csae8092 authored Feb 2, 2024
2 parents 6dc136f + f1e2d47 commit 126effd
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 5 deletions.
7 changes: 6 additions & 1 deletion apis_core/apis_entities/list_view_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"end_end_date",
"status",
"source",
"references",
"published",
"tempentityclass_ptr",
"review",
Expand All @@ -54,6 +53,11 @@ class PersonListFilter(MyBaseFilter):
method="name_label_filter",
help_text="eingegebene Zeichenkette muss im Vornamen, Nachnamem oder in einem Label enthalten sein",
)
references = django_filters.CharFilter(
lookup_expr="icontains",
label="Referenzen",
help_text="eingegebene Zeichenkette muss im Textfeld 'Referenzen' enthalten sein",
)
gender = django_filters.ChoiceFilter(
choices=(("", "egal"), ("male", "männlich"), ("female", "weiblich"))
)
Expand Down Expand Up @@ -166,6 +170,7 @@ def __init__(self, *args, **kwargs):
"birth_year",
"death_year",
"collection",
"references",
css_id="more",
),
AccordionGroup(
Expand Down
2 changes: 1 addition & 1 deletion apis_core/apis_entities/list_view_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class WorkListFilter(MyBaseFilter):
references = django_filters.CharFilter(
lookup_expr="icontains",
label="Referenzen",
help_text="eingegebene Zeichenkette muss im Titel enthalten sein",
help_text="eingegebene Zeichenkette muss im Textfeld 'Referenzen' enthalten sein",
)
year_of_creation = django_filters.NumberFilter(
field_name="start_date__year", label="Schöpfungsdatum", help_text="z.B. 1880"
Expand Down
2 changes: 1 addition & 1 deletion browsing/templates/browsing/partials/column_selector.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if togglable_colums %}
<label class="form-label pt-3" for="column_selector">Select additional columns:</label>
<label class="form-label pt-3" for="column_selector">Weitere Spalten hinzufügen</label>
<select class="form-control mb-3" multiple name="columns" id="column_selector">
{% for key, value in togglable_colums.items %}
{% if key == 'merge' and user.is_authenticated and enable_merge %}
Expand Down
40 changes: 39 additions & 1 deletion issue__17_dataimports_part2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"outputs": [],
"source": [
"from acdh_tei_pyutils.tei import TeiReader\n",
"from acdh_tei_pyutils.utils import get_xmlid, normalize_string\n",
"from tqdm import tqdm\n",
"from icecream import ic\n",
"from normdata.utils import import_from_normdata"
Expand Down Expand Up @@ -87,7 +88,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"no import entities without normdata records\")"
"print(\"now import entities without normdata records\")"
]
},
{
Expand Down Expand Up @@ -168,6 +169,43 @@
"id": "77e897d5",
"metadata": {},
"outputs": [],
"source": [
"for x in tqdm(doc.any_xpath(\".//tei:person[@xml:id][./tei:listBibl]\")):\n",
" ref = []\n",
" for y in x.xpath(\".//tei:bibl[./tei:biblScope]\", namespaces=nsmap):\n",
" volume = y.xpath(\"./tei:biblScope[@unit='volume']\", namespaces=nsmap)[0].text\n",
" page = y.xpath(\"./tei:biblScope[@unit='page']\", namespaces=nsmap)[0].text\n",
" if volume.endswith(\".\"):\n",
" volume = normalize_string(volume[:-1])\n",
" try:\n",
" page = f\"S. {normalize_string(page)}\"\n",
" except AttributeError:\n",
" continue\n",
" quote = f\"{volume}, {page}.\"\n",
" ref.append(quote)\n",
" all_quotes = (\" *** \".join(ref)) \n",
" \n",
" hbtv_uri = get_xmlid(x)\n",
" work_uri = f\"{bahr_url}{hbtv_uri}\"\n",
" work = Uri.objects.get(uri=work_uri).entity.get_child_entity()\n",
" orig_ref = work.references\n",
" if orig_ref:\n",
" if all_quotes in orig_ref:\n",
" continue\n",
" try:\n",
" new_ref = orig_ref + \"\\n\" + all_quotes\n",
" except TypeError:\n",
" new_ref = \"\\n\" + all_quotes\n",
" work.references = new_ref\n",
" work.save()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "67ccffad",
"metadata": {},
"outputs": [],
"source": []
}
],
Expand Down
2 changes: 1 addition & 1 deletion pmb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
APIS_DETAIL_VIEWS_ALLOWED = True
DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap5.html"
DJANGO_TABLES2_TABLE_ATTRS = {
"class": "table table-hover table-borderless",
"class": "table table-hover table-borderless table-relations",
}
# Application definition

Expand Down
6 changes: 6 additions & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,10 @@ main {

.table-borderless {
border: none;
}

.table-relations th,
.table-relations th
{
width: 25% !important;
}

0 comments on commit 126effd

Please sign in to comment.