Skip to content

Commit

Permalink
Fixed issue of not linking STR IDs when uploading instances
Browse files Browse the repository at this point in the history
  • Loading branch information
pgathogo committed Oct 16, 2018
1 parent 8e85faa commit 58f0da0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions geoodk/importer/entity_importer.py
Expand Up @@ -321,10 +321,15 @@ def save_to_db(self):
try:
if self.parents_ids is not None and self.entity.short_name == 'social_tenure_relationship':
str_tables = current_profile().social_tenure
setattr(self.model, str_tables.parties[0].short_name.lower() + '_id',
self.parents_ids.get(str_tables.parties[0].name)[0])
setattr(self.model, str_tables.spatial_units[0].short_name.lower() + '_id',
self.parents_ids.get(str_tables.spatial_units[0].name)[0])
prefix = current_profile().prefix+'_'

full_party_ref_column = str_tables.parties[0].name
party_ref_column = str_tables.parties[0].name.lower().replace(prefix,'')+ '_id'
setattr(self.model, party_ref_column, self.parents_ids.get(full_party_ref_column)[0])

full_spatial_ref_column = str_tables.spatial_units[0].name
spatial_ref_column = str_tables.spatial_units[0].name.lower().replace(prefix,'') + '_id'
setattr(self.model, spatial_ref_column, self.parents_ids.get(full_spatial_ref_column)[0])
except:
pass
for k, v in self.attributes.iteritems():
Expand Down

0 comments on commit 58f0da0

Please sign in to comment.