diff --git a/openatlas/api/formats/loud.py b/openatlas/api/formats/loud.py index 738bcba10..9f5efdbbc 100644 --- a/openatlas/api/formats/loud.py +++ b/openatlas/api/formats/loud.py @@ -95,7 +95,7 @@ def get_domain_links() -> dict[str, Any]: "type": "DigitalObject"}]}) return {'@context': app.config['API_CONTEXT']['LOUD']} | \ - base_entity_dict() | properties_set # type: ignore + base_entity_dict() | properties_set def get_loud_timespan(entity: Entity) -> dict[str, Any]: diff --git a/openatlas/display/base_display.py b/openatlas/display/base_display.py index d53a2d70e..3477f1684 100644 --- a/openatlas/display/base_display.py +++ b/openatlas/display/base_display.py @@ -378,7 +378,7 @@ def add_tabs(self) -> None: and current_user.settings['module_map_overlay']: self.tabs['file'].table.header.append(_('overlay')) - for link_ in entity.get_links('P67', inverse=True): + for link_ in entity.get_links(['P31', 'P67'], inverse=True): domain = link_.domain data = get_base_table_data(domain) if domain.class_.view == 'file': diff --git a/openatlas/display/display.py b/openatlas/display/display.py index 9ed577281..215471f1d 100644 --- a/openatlas/display/display.py +++ b/openatlas/display/display.py @@ -166,7 +166,7 @@ class ModificationDisplay(EventsDisplay): def add_data(self) -> None: super().add_data() - self.data[_('artifact')] = \ + self.data[_('object')] = \ [link(entity) for entity in self.entity.get_linked_entities('P31')] diff --git a/openatlas/forms/field.py b/openatlas/forms/field.py index 138ed3051..68bfec08d 100644 --- a/openatlas/forms/field.py +++ b/openatlas/forms/field.py @@ -155,7 +155,8 @@ def __call__( **kwargs: Any) -> TableMultiSelect: data = field.data or [] data = ast.literal_eval(data) if isinstance(data, str) else data - class_ = field.id if field.id != 'given_place' else 'place' + class_ = field.id \ + if field.id not in ['given_place', 'modified_place'] else 'place' aliases = current_user.settings['table_show_aliases'] if class_ in ['group', 'person']: entities = Entity.get_by_class(class_, types=True, aliases=aliases) diff --git a/openatlas/forms/manager.py b/openatlas/forms/manager.py index ba87c0f8e..4de4b7bcc 100644 --- a/openatlas/forms/manager.py +++ b/openatlas/forms/manager.py @@ -389,19 +389,29 @@ class ModificationManager(EventBaseManager): def additional_fields(self) -> dict[str, Any]: return dict( super().additional_fields(), - **{'artifact': TableMultiField()}) + **{ + 'artifact': TableMultiField(), + 'modified_place': TableMultiField('place')}) def populate_update(self) -> None: super().populate_update() - self.form.artifact.data = \ - [item.id for item in self.entity.get_linked_entities('P31')] + artifact_data = [] + place_data = [] + for item in self.entity.get_linked_entities('P31'): + if item.class_.name == 'artifact': + artifact_data.append(item.id) + elif item.cidoc_class.code == 'E18': + place_data.append(item.id) + self.form.artifact.data = artifact_data + self.form.modified_place.data = place_data def process_form(self) -> None: super().process_form() self.data['links']['delete'].add('P31') if self.form.artifact.data: self.add_link('P31', self.form.artifact.data) - + if self.form.modified_place.data: + self.add_link('P31', self.form.modified_place.data) class MoveManager(EventBaseManager): diff --git a/openatlas/views/changelog.py b/openatlas/views/changelog.py index 561d609bf..2ca6a7953 100644 --- a/openatlas/views/changelog.py +++ b/openatlas/views/changelog.py @@ -18,6 +18,7 @@ def index_changelog() -> str: '7.17.0': ['TBA', { 'feature': { '2026': 'External reference systems for type hierarchies', + '2070': 'Modification (E11) for Place (E18)', '2083': 'API: List of images'}, 'fix': { '2078': 'API: CSV export not working' diff --git a/tests/test_event.py b/tests/test_event.py index 224c6463a..ce11a30a3 100644 --- a/tests/test_event.py +++ b/tests/test_event.py @@ -111,7 +111,10 @@ def test_event(self) -> None: rv = self.app.post( url_for('insert', class_='modification'), - data={'name': 'A modification event', 'artifact': artifact.id}) + data={ + 'name': 'A modification event', + 'artifact': artifact.id, + 'modified_place': residence.id}) modification_id = rv.location.split('/')[-1] rv = self.app.get(url_for('view', id_=modification_id))