diff --git a/apis_core/apis_entities/api_urls.py b/apis_core/apis_entities/api_urls.py index e1efaa1..f28a535 100644 --- a/apis_core/apis_entities/api_urls.py +++ b/apis_core/apis_entities/api_urls.py @@ -1,29 +1,30 @@ -from django.conf import settings -from django.conf.urls import url from django.urls import path from . import api_views -app_name = 'apis_entities' +app_name = "apis_entities" urlpatterns = [ - url(r'^savenetworkfiles/$', api_views.SaveNetworkFiles.as_view()), - url(r'^getorcreateentity/$', api_views.GetOrCreateEntity.as_view(), name='GetOrCreateEntity'), - path(r'entity//', api_views.GetEntityGeneric.as_view(), name="GetEntityGeneric"), - path(r'uri/', api_views.uri_resolver, name="UriResolver"), - path(r'getrelatedplaces/', api_views.GetRelatedPlaces.as_view(), name="GetRelatedPlaces"), - path(r'lifepath//', api_views.LifePathViewset.as_view(), name="Lifepathviewset") + path("savenetworkfiles/", api_views.SaveNetworkFiles.as_view()), + path( + "getorcreateentity/", + api_views.GetOrCreateEntity.as_view(), + name="GetOrCreateEntity", + ), + path( + r"entity//", + api_views.GetEntityGeneric.as_view(), + name="GetEntityGeneric", + ), + path(r"uri/", api_views.uri_resolver, name="UriResolver"), + path( + r"getrelatedplaces/", + api_views.GetRelatedPlaces.as_view(), + name="GetRelatedPlaces", + ), + path( + r"lifepath//", + api_views.LifePathViewset.as_view(), + name="Lifepathviewset", + ), ] - -if 'deep learning' in getattr(settings, "APIS_COMPONENTS", []) and 'apis_highlighter' in settings.INSTALLED_APPS: - from apis_highlighter.api_views import TestDLModel - urlpatterns.append(url(r'^nlp_model/$', TestDLModel.as_view(), name='TestDLModel'),) - -if 'apis_highlighter' in settings.INSTALLED_APPS: - from apis_highlighter.api_views import AnnotatorAgreementView, ShowOverlappingHighlights - urlpatterns.extend([url(r'^annotatoragreement/$', - AnnotatorAgreementView.as_view(), - name='AnnotatorAgreementView'), - url(r'^overlappinghighlights/$', - ShowOverlappingHighlights.as_view(), - name='ShowOverlappingHighlights')]) diff --git a/apis_core/apis_entities/filters.py b/apis_core/apis_entities/filters.py index 0b93416..feff3f3 100644 --- a/apis_core/apis_entities/filters.py +++ b/apis_core/apis_entities/filters.py @@ -91,11 +91,6 @@ def eliminate_unused_filters(default_filter_dict): """ enabled_filters = settings.APIS_ENTITIES[self.Meta.model.__name__]["list_filters"] - if "apis_ampel" in settings.INSTALLED_APPS: - from apis_ampel.helper_functions import is_ampel_active - from apis_ampel.models import AmpelTemp - if is_ampel_active(self.Meta.model.__name__): - enabled_filters = ["ampel", "ampel_note", "ampel_notes_field", "ampel_references_field"] + enabled_filters filter_dict_tmp = {} diff --git a/apis_core/apis_entities/templates/apis_entities/entity_create_generic.html b/apis_core/apis_entities/templates/apis_entities/entity_create_generic.html index 845f69b..a625374 100644 --- a/apis_core/apis_entities/templates/apis_entities/entity_create_generic.html +++ b/apis_core/apis_entities/templates/apis_entities/entity_create_generic.html @@ -203,7 +203,7 @@

$('#tab_'+data.tab).find('div:eq(1)').remove(); $('#tab_'+data.tab).append(data.form); $('#form_PersonInstitutionForm div:first div:first select').focus(); - //$(".form.ajax_form").unbind() + //(".form.ajax_form").unbind() }; if (!$.ApisForms) { $.ApisForms = {} @@ -247,7 +247,7 @@

function EntityRelationForm_response(response){ if (response.test == false) { $('#'+response.DivID).replaceWith(response.form); - //$(".form.ajax_form").unbind(); + //(".form.ajax_form").unbind(); if ($.ApisHigh.tt_instance_detail) { if ($.ApisHigh.tt_instance_detail["__state"] == 'stable') { $.ApisHigh.tt_instance_detail.content(response.form); @@ -279,7 +279,7 @@

function HighlForm_response(response){ if (response.test == false) { $.ApisHigh.tt_instance.content(response.form); - //$(".form.ajax_form").unbind() + //(".form.ajax_form").unbind() } else { $('#tab_'+response.tab+' div.table-container').remove(); $('#tab_'+response.tab).prepend(response.table_html); @@ -297,7 +297,7 @@

function PAddRelation_response(response){ if (response.test == false) { $.ApisHigh.tt_instance.content(response.form); - //$(".form.ajax_form").unbind() + //(".form.ajax_form").unbind() } else { $('#htxt_'+response.text.id).html($.parseHTML(response.text.text)) $.ApisHigh.tt_instance.close() diff --git a/apis_core/apis_entities/templates/apis_entities/generic_network_visualization.html b/apis_core/apis_entities/templates/apis_entities/generic_network_visualization.html index 5e98902..03e843d 100644 --- a/apis_core/apis_entities/templates/apis_entities/generic_network_visualization.html +++ b/apis_core/apis_entities/templates/apis_entities/generic_network_visualization.html @@ -337,7 +337,7 @@

n.x = Math.random(); n.y = Math.random(); - n.size = 10*(1-1/$.ApisNet.instance.graph.degree(n.id)); + n.size = 10*(1-1/.ApisNet.instance.graph.degree(n.id)); if (n.type === 'person') { n.color = '#5FB404'; } else if (n.type === 'institution') { @@ -634,7 +634,7 @@

}; // Instanciate the tooltips plugin with a Mustache renderer for node tooltips: $.ApisNet.tooltip = sigma.plugins.tooltips($.ApisNet.instance, $.ApisNet.instance.renderers[0], config); -//$.ApisNet.instance.bind("rightClickNode", delete_nodes); +//.ApisNet.instance.bind("rightClickNode", delete_nodes); $.ApisNet.instance.bind("rightClickNode", select_unselect_node); }; @@ -647,8 +647,8 @@

$('#id_select_relation').on("change", function(){ var list_ent = $(this).val().split('-') console.log(list_ent); - //$('#id_select_kind-autocomplete').yourlabsAutocomplete('destroy'); - //$('#id_select_kind-autocomplete').yourlabsAutocomplete({'url': new_val, 'minimumCharacters': 2}); + //('#id_select_kind-autocomplete').yourlabsAutocomplete('destroy'); + //('#id_select_kind-autocomplete').yourlabsAutocomplete({'url': new_val, 'minimumCharacters': 2}); $('#id_search_source').select2('destroy'); $('#id_search_source').select2({ @@ -676,8 +676,8 @@

// Additional AJAX parameters go here; see the end of this chapter for the full code of this example } }); - //$('#id_search_target-autocomplete').yourlabsAutocomplete('destroy'); - //$('#id_search_target-autocomplete').yourlabsAutocomplete({'url': new_val_target, 'minimumCharacters': 2}); + //('#id_search_target-autocomplete').yourlabsAutocomplete('destroy'); + //('#id_search_target-autocomplete').yourlabsAutocomplete({'url': new_val_target, 'minimumCharacters': 2}); }) }) diff --git a/apis_core/apis_entities/templates/apis_entities/generic_network_visualization_bak.html b/apis_core/apis_entities/templates/apis_entities/generic_network_visualization_bak.html index be210f2..49f0c52 100644 --- a/apis_core/apis_entities/templates/apis_entities/generic_network_visualization_bak.html +++ b/apis_core/apis_entities/templates/apis_entities/generic_network_visualization_bak.html @@ -209,7 +209,7 @@ n.x = Math.random(); n.y = Math.random(); - n.size = 10*(1-1/$.ApisNet.instance.graph.degree(n.id)); + n.size = 10*(1-1/.ApisNet.instance.graph.degree(n.id)); if (n.type === 'person') { n.color = '#5FB404'; } else if (n.type === 'institution') { @@ -461,7 +461,7 @@ }; // Instanciate the tooltips plugin with a Mustache renderer for node tooltips: $.ApisNet.tooltip = sigma.plugins.tooltips($.ApisNet.instance, $.ApisNet.instance.renderers[0], config); -//$.ApisNet.instance.bind("rightClickNode", delete_nodes); +//.ApisNet.instance.bind("rightClickNode", delete_nodes); $.ApisNet.instance.bind("rightClickNode", select_unselect_node); }; @@ -469,8 +469,8 @@ var list_ent = $(this).val().split('-') console.log(list_ent); console.log("changed"); - //$('#id_select_kind-autocomplete').yourlabsAutocomplete('destroy'); - //$('#id_select_kind-autocomplete').yourlabsAutocomplete({'url': new_val, 'minimumCharacters': 2}); + //('#id_select_kind-autocomplete').yourlabsAutocomplete('destroy'); + //('#id_select_kind-autocomplete').yourlabsAutocomplete({'url': new_val, 'minimumCharacters': 2}); $('#id_search_source').select2('destroy'); $('#id_search_source').select2({ @@ -498,8 +498,8 @@ // Additional AJAX parameters go here; see the end of this chapter for the full code of this example } }); - //$('#id_search_target-autocomplete').yourlabsAutocomplete('destroy'); - //$('#id_search_target-autocomplete').yourlabsAutocomplete({'url': new_val_target, 'minimumCharacters': 2}); + //('#id_search_target-autocomplete').yourlabsAutocomplete('destroy'); + //('#id_search_target-autocomplete').yourlabsAutocomplete({'url': new_val_target, 'minimumCharacters': 2}); }) }) diff --git a/apis_core/apis_entities/templates/apis_entities/person_create.html b/apis_core/apis_entities/templates/apis_entities/person_create.html index 752c80c..919443b 100644 --- a/apis_core/apis_entities/templates/apis_entities/person_create.html +++ b/apis_core/apis_entities/templates/apis_entities/person_create.html @@ -253,7 +253,7 @@

success: function(data) { console.log('yes') // update our tooltip content with our returned data and cache it - //$('#tab_'+data.tab).find('div').remove(); + //('#tab_'+data.tab).find('div').remove(); $('#tab_'+data.tab).append(data.form); $(".form.ajax_form").unbind() unbind_ajax_forms(); diff --git a/apis_core/apis_entities/templates/apis_entities/person_create_new.html b/apis_core/apis_entities/templates/apis_entities/person_create_new.html index ed37570..7b53cef 100644 --- a/apis_core/apis_entities/templates/apis_entities/person_create_new.html +++ b/apis_core/apis_entities/templates/apis_entities/person_create_new.html @@ -124,7 +124,7 @@

success: function(data) { console.log('yes') // update our tooltip content with our returned data and cache it - //$('#tab_'+data.tab).find('div').remove(); + //('#tab_'+data.tab).find('div').remove(); $('#tab_'+data.tab).append(data.form); $(".form.ajax_form").unbind() unbind_ajax_forms(); diff --git a/apis_core/apis_entities/templates/apis_entities/place_create_generic.html b/apis_core/apis_entities/templates/apis_entities/place_create_generic.html index 66637a8..874a9d7 100644 --- a/apis_core/apis_entities/templates/apis_entities/place_create_generic.html +++ b/apis_core/apis_entities/templates/apis_entities/place_create_generic.html @@ -125,7 +125,7 @@

} $.ApisMaps.PlaceMap.map.fitBounds($.ApisMaps.PlaceMap.markers.getBounds(), {'maxZoom': 12}) - //$(data).each(function(key, data) { + //(data).each(function(key, data) { // district_boundary.addData(data); //}); diff --git a/apis_core/apis_entities/urls.py b/apis_core/apis_entities/urls.py index 514ec32..dc6685e 100644 --- a/apis_core/apis_entities/urls.py +++ b/apis_core/apis_entities/urls.py @@ -12,57 +12,57 @@ urlpatterns = [ path( - "entity/(?P[a-z]+)//edit", + "entity///edit", views2.GenericEntitiesEditView.as_view(), name="generic_entities_edit_view", ), path( - "entity/(?P[a-z]+)//detail", + "entity///detail", detail_views.GenericEntitiesDetailView.as_view(), name="generic_entities_detail_view", ), path( - "entity/(?P[a-z]+)/create", + "entity//create", views2.GenericEntitiesCreateView.as_view(), name="generic_entities_create_view", ), path( - "entity/(?P[a-z]+)//delete", + "entity///delete", views2.GenericEntitiesDeleteView.as_view(), name="generic_entities_delete_view", ), path( - "entity/(?P[a-z]+)/list/", + "entity//list/", views.GenericListViewNew.as_view(), name="generic_entities_list", ), path( - "autocomplete/createstanbol/(?P[a-zA-Z0-9-]+)/", + "autocomplete/createstanbol//", GenericEntitiesCreateStanbolView.as_view(), name="generic_entities_stanbol_create", ), path( - "autocomplete/createstanbol/(?P[a-zA-Z0-9-]+)/(?P[0-9]+)/", + "autocomplete/createstanbol//(?P[0-9]+)/", GenericEntitiesCreateStanbolView.as_view(), name="generic_entities_stanbol_create", ), path( - "autocomplete/(?P[a-zA-Z0-9-]+)/(?P[0-9]+)/", + "autocomplete//(?P[0-9]+)/", GenericEntitiesAutocomplete.as_view(), name="generic_entities_autocomplete", ), path( - "autocomplete/(?P[a-zA-Z0-9-]+)/", + "autocomplete//", GenericEntitiesAutocomplete.as_view(), name="generic_entities_autocomplete", ), path( - "autocomplete/(?P[a-zA-Z0-9-]+)/(?P[a-z]+)/", + "autocomplete//(?P[a-z]+)/", GenericEntitiesAutocomplete.as_view(), name="generic_entities_autocomplete", ), path( - "autocomplete-network/(?P[a-zA-Z0-9-]+)/", + "autocomplete-network//", GenericNetworkEntitiesAutocomplete.as_view(), name="generic_network_entities_autocomplete", ), diff --git a/apis_core/apis_metainfo/dal_urls.py b/apis_core/apis_metainfo/dal_urls.py index eca1d8d..695c548 100644 --- a/apis_core/apis_metainfo/dal_urls.py +++ b/apis_core/apis_metainfo/dal_urls.py @@ -6,7 +6,7 @@ urlpatterns = [ path( - "tempentity-autocomplete/$", + "tempentity-autocomplete/", dal_views.TempEntityClassAC.as_view(), name="apis_tempentity-autocomplete", ) diff --git a/apis_core/apis_relations/urls.py b/apis_core/apis_relations/urls.py index 9d0b889..b887770 100644 --- a/apis_core/apis_relations/urls.py +++ b/apis_core/apis_relations/urls.py @@ -6,16 +6,16 @@ app_name = "apis_relations" urlpatterns = [ - path("ajax/get/$", views.get_form_ajax, name="get_form_ajax"), - path("ajax/save/(?P\w+)/(?P\w+)/(?P[0-9]+)(?:/(?P[0-9]*))?/$", + path("ajax/get/", views.get_form_ajax, name="get_form_ajax"), + path("ajax/save/////", views.save_ajax_form, name="save_ajax_form", ), - path("(?P[a-z]+)/list/$", + path("/list/", rel_views.GenericRelationView.as_view(), name="generic_relations_list", ), - path("(?P[a-z]+)//detail$", + path("//detail", rel_views.GenericRelationDetailView.as_view(), name="generic_relations_detail_view", ), diff --git a/apis_core/apis_tei/tei_urls.py b/apis_core/apis_tei/tei_urls.py index b0d1a73..1c2ce6b 100644 --- a/apis_core/apis_tei/tei_urls.py +++ b/apis_core/apis_tei/tei_urls.py @@ -8,19 +8,19 @@ urlpatterns = [ path( - "autocomplete/(?P[a-zA-Z0-9-]+)/$", + "autocomplete//", TeiEntAc.as_view(), name="generic_entities_autocomplete", ), path( - "tei-completer/(?P[a-zA-Z0-9-]+)/$", + "tei-completer//", TeiCompleterAc.as_view(), name="tei_completer_autocomplete", ), - path("person/$", views.person_as_tei, name="person_as_tei"), - path("place/$", views.place_as_tei, name="place_as_tei"), - path("org/$", views.org_as_tei, name="org_as_tei"), - path("institution/$", views.org_as_tei, name="org_as_tei"), - path("work/$", views.work_as_tei, name="work_as_tei"), + path("person/", views.person_as_tei, name="person_as_tei"), + path("place/", views.place_as_tei, name="place_as_tei"), + path("org/", views.org_as_tei, name="org_as_tei"), + path("institution/", views.org_as_tei, name="org_as_tei"), + path("work/", views.work_as_tei, name="work_as_tei"), path("uri-to-tei", views.uri_to_tei, name="uri_to_tei"), ] diff --git a/apis_core/apis_vis/urls.py b/apis_core/apis_vis/urls.py index 09abeae..53b146c 100644 --- a/apis_core/apis_vis/urls.py +++ b/apis_core/apis_vis/urls.py @@ -5,17 +5,17 @@ app_name = 'apis_vis' urlpatterns = [ - url(r'^heatmap/$', views.HeatMapView.as_view(), name='heatmap_view'), - url(r'^heatmap-data/$', views.get_heatmap_data, name='get_heatmap_data'), - url(r'^avg-age-data/$', views.get_average_age_data, name='get_avg_age_data'), - url(r'^avg-age/$', views.AvgAge.as_view(), name='avgage_view'), - url(r'^avg-members-data/$', views.get_average_members_data, name='get_avg_members_data'), - url(r'^avg-members/$', views.MembersAmountPerYear.as_view(), name='avg_members_view'), + url(r'^heatmap/', views.HeatMapView.as_view(), name='heatmap_view'), + url(r'^heatmap-data/', views.get_heatmap_data, name='get_heatmap_data'), + url(r'^avg-age-data/', views.get_average_age_data, name='get_avg_age_data'), + url(r'^avg-age/', views.AvgAge.as_view(), name='avgage_view'), + url(r'^avg-members-data/', views.get_average_members_data, name='get_avg_members_data'), + url(r'^avg-members/', views.MembersAmountPerYear.as_view(), name='avg_members_view'), url( - r'^(?P[a-z]+)/data/$', + r'^(?P[a-z]+)/data/', api_views.GetVisJson.as_view(), name='person-institution-data' ), - url(r'^inst-range-data/$', views.get_inst_range_data, name='get_inst_range_data'), - url(r'^inst-range/$', views.InstRange.as_view(), name='inst_range_view'), + url(r'^inst-range-data/', views.get_inst_range_data, name='get_inst_range_data'), + url(r'^inst-range/', views.InstRange.as_view(), name='inst_range_view'), ] diff --git a/apis_core/apis_vocabularies/urls.py b/apis_core/apis_vocabularies/urls.py index f4dcccd..a5c07ac 100644 --- a/apis_core/apis_vocabularies/urls.py +++ b/apis_core/apis_vocabularies/urls.py @@ -7,7 +7,7 @@ urlpatterns = [ path("download//", views.dl_vocabs_as_csv, name="dl-vocabs"), - path("autocomplete/(?P[a-zA-Z0-9-]+)/(?P[a-zA-Z0-9-]+)/$", + path("autocomplete///", GenericVocabulariesAutocomplete.as_view(), name="generic_vocabularies_autocomplete", ), diff --git a/dumper/templates/dumper/index.html b/dumper/templates/dumper/index.html index 37f8732..a290018 100644 --- a/dumper/templates/dumper/index.html +++ b/dumper/templates/dumper/index.html @@ -1,31 +1,6 @@ - - - - - - - - - - - - PMB-XML/TEI Service - - - - +{% extends "base.html" %} +{% load static %} +{% block content %}
@@ -104,8 +79,4 @@
HELPDESK
© Copyright OEAW | Impressum | GitHub
- - - - - \ No newline at end of file +{% endblock %} \ No newline at end of file diff --git a/pmb/settings.py b/pmb/settings.py index f318b8c..24fc009 100644 --- a/pmb/settings.py +++ b/pmb/settings.py @@ -61,7 +61,7 @@ TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], + "DIRS": [BASE_DIR / "templates"], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -169,9 +169,80 @@ "https://pmb.acdh.oeaw.ac.at/apis/entities/entity/{}/{}/detail" ) APIS_ENTITIES = { - "Place": {}, - "Person": {}, - "Institution": {}, - "Work": {}, - "Event": {}, + "Place": { + "merge": True, + "search": ["name"], + "form_order": ["name", "kind", "lat", "lng", "status", "collection"], + "table_fields": ["name"], + "additional_cols": ["id", "lat", "lng", "part_of"], + "list_filters": [ + {"name": {"method": "name_label_filter"}}, + {"collection": {"label": "Collection"}}, + {"kind": {"label": "Kind of Place"}}, + "related_entity_name", + "related_relationtype_name", + "lat", + "lng", + ], + }, + "Person": { + "merge": True, + "search": ["name", "first_name"], + "form_order": ["first_name", "name", "start_date_written", "end_date_written", "profession", "status", "collection"], + "table_fields": ["name", "first_name", "start_date_written", "end_date_written"], + "additional_cols": ["id", "profession", "gender"], + "list_filters": [ + "name", + {"gender": {"label": "Gender"}}, + {"start_date": {"label": "Date of Birth"}}, + {"end_date": {"label": "Date of Death"}}, + {"profession": {"label": "Profession"}}, + {"title": {"label": "Title"}}, + {"collection": {"label": "Collection"}}, + "related_entity_name", + "related_relationtype_name", + ], + }, + "Institution": { + "merge": True, + "search": ["name"], + "form_order": ["name", "start_date_written", "end_date_written", "kind", "status", "collection"], + "additional_cols": ["id", "kind", ], + "list_filters": [ + {"name": {"label": "Name or label of institution"}}, + {"kind": {"label": "Kind of Institution"}}, + {"start_date": {"label": "Date of foundation"}}, + {"end_date": {"label": "Date of termination"}}, + {"collection": {"label": "Collection"}}, + "related_entity_name", + "related_relationtype_name", + ], + }, + "Work": { + "merge": True, + "search": ["name"], + "additional_cols": ["id", "kind", ], + "list_filters": [ + {"name": {"label": "Name of work"}}, + {"kind": {"label": "Kind of Work"}}, + {"start_date": {"label": "Date of creation"}}, + {"collection": {"label": "Collection"}}, + "related_entity_name", + "related_relationtype_name", + ], + }, + "Event": { + "merge": True, + "search": ["name"], + "additional_cols": ["id", ], + "list_filters": [ + {"name": {"label": "Name of event"}}, + {"kind": {"label": "Kind of Event"}}, + {"start_date": {"label": "Date of beginning"}}, + {"end_date": {"label": "Date of end"}}, + {"collection": {"label": "Collection"}}, + "related_entity_name", + "related_relationtype_name", + ], + }, } diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..3826868 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,13 @@ + + + + + + Bootstrap demo + + + + {% block content %}{% endblock content %} + + +