Skip to content

Commit

Permalink
Fix for error adding administrative unit (#1616)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Feb 10, 2022
1 parent 215ce35 commit d4acb80
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from openatlas import app

VERSION = '7.0.3'
VERSION = '7.0.4'
DATABASE_VERSION = '6.6.0'
DEMO_MODE = False # If activated some options are disabled, login is pre filled
IS_UNIT_TEST = False
Expand Down
3 changes: 2 additions & 1 deletion openatlas/models/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def update(
self.update_attributes(data['attributes'])
if 'aliases' in data:
self.update_aliases(data['aliases'])
if 'administrative_units' in data:
if 'administrative_units' in data \
and self.class_.name != 'administrative_unit':
self.update_administrative_units(data['administrative_units'], new)
if 'links' in data:
redirect_link_id = self.update_links(data['links'], new)
Expand Down
3 changes: 3 additions & 0 deletions openatlas/util/changelog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
class Changelog:

versions = {
'7.0.4': ['2022-02-10', {
'fix': {
'1616': 'Error at inserting an administrative unit'}}],
'7.0.3': ['2022-02-02', {
'fix': {
'1634': 'Value Type with Subtype error'}}],
Expand Down
18 changes: 10 additions & 8 deletions tests/test_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ def test_type(self) -> None:
rv = self.app.get(
url_for('insert', class_='type', origin_id=actor_type.id))
assert b'Actor actor relation' in rv.data
rv = self.app.post(
url_for('insert', class_='type', origin_id=actor_type.id),
data={'name_search': 'new'})
assert b'Inverse' in rv.data
data = {
'name': 'My secret type',
'name_inverse': 'Do I look inverse?',
Expand All @@ -43,7 +39,7 @@ def test_type(self) -> None:
follow_redirects=True)
assert b'Changes have been saved.' in rv.data

# Insert an continue
# Insert and continue
data['continue_'] = 'yes'
rv = self.app.post(
url_for('insert', class_='type', origin_id=actor_type.id),
Expand Down Expand Up @@ -86,12 +82,18 @@ def test_type(self) -> None:
assert b'Male' in rv.data

# Administrative unit
admin_unit_id = Type.get_hierarchy('Administrative unit').id
rv = self.app.get(
url_for('view', id_=admin_unit_id), follow_redirects=True)
assert b'Austria' in rv.data
rv = self.app.post(
url_for(
'view',
id_=Type.get_hierarchy('Administrative unit').id),
'insert',
class_='administrative_unit',
origin_id=g.types[admin_unit_id].subs[0]),
data={'name': 'admin unit'},
follow_redirects=True)
assert b'Austria' in rv.data
assert b'An entry has been created' in rv.data

# Value type
rv = self.app.get(
Expand Down

0 comments on commit d4acb80

Please sign in to comment.