Skip to content

Commit

Permalink
Form fixes after refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Apr 5, 2024
1 parent fa6c359 commit ebe7601
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions openatlas/forms/base_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ def additional_fields(self) -> dict[str, Any]:
residence,
add_dynamic=['place']),
'begins_in': TableField(
table('begins in', self.table_items['place']),
table('begins_in', self.table_items['place']),
begins_in,
add_dynamic=['place']),
'ends_in': TableField(
table('begins in', self.table_items['place']),
table('ends_in', self.table_items['place']),
ends_in,
add_dynamic=['place'])}

Expand Down Expand Up @@ -417,8 +417,8 @@ def additional_fields(self) -> dict[str, Any]:
sub_filter_ids),
event_preceding)
if self.class_.name != 'move':
fields['place'] = TableField(
table('place', self.table_items['place']),
fields['location'] = TableField(
table('location', self.table_items['place']),
place,
add_dynamic=['place'])
return fields
Expand All @@ -427,7 +427,7 @@ def populate_insert(self) -> None:
if self.origin \
and self.origin.class_.view == 'place' \
and self.class_.name != 'move':
self.form.place.data = self.origin.id
self.form.location.data = self.origin.id

def process_form(self) -> None:
super().process_form()
Expand All @@ -438,11 +438,11 @@ def process_form(self) -> None:
self.add_link('P134', self.form.event_preceding.data)
if self.class_.name != 'move':
self.data['links']['delete'].add('P7')
if self.form.place.data:
if self.form.location.data:
self.add_link(
'P7',
Entity.get_linked_entity_safe_static(
int(self.form.place.data),
int(self.form.location.data),
'P53'))
if self.origin and self.origin.class_.view == 'actor':
self.add_link('P11', self.origin, return_link_id=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_event(self) -> None:
rv: Any = self.app.get(url_for('insert', class_='activity'))
assert b'+ Activity' in rv.data

data = {'name': 'Event Horizon', 'place': residence.id}
data = {'name': 'Event Horizon', 'location': residence.id}
rv = self.app.post(
url_for('insert', class_='activity'),
data=data)
Expand Down Expand Up @@ -61,7 +61,7 @@ def test_event(self) -> None:
data={
'name': 'Second event',
'given_place': [residence.id],
'place': residence.id,
'location': residence.id,
'sub_event_of': activity_id,
'begin_year_from': '1949',
'begin_month_from': '10',
Expand Down

0 comments on commit ebe7601

Please sign in to comment.