Skip to content

Commit

Permalink
Merge branch 'develop' into feature/iiif
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Oct 10, 2023
2 parents 8300ad5 + 2bd5b31 commit c85f633
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion openatlas/api/formats/loud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion openatlas/display/base_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion openatlas/display/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')]


Expand Down
3 changes: 2 additions & 1 deletion openatlas/forms/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 14 additions & 4 deletions openatlas/forms/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
1 change: 1 addition & 0 deletions openatlas/views/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 4 additions & 1 deletion tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit c85f633

Please sign in to comment.