Skip to content

Commit

Permalink
App Datenmanagement: Erweiterung Darstellungsmöglichkeiten Adressensu…
Browse files Browse the repository at this point in the history
…chresultate
  • Loading branch information
gdmhrogut committed Nov 3, 2023
1 parent fd5c144 commit b15d6d7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions datenmanagement/models/models_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2972,6 +2972,7 @@ class Meta(SimpleModel.Meta):
class BasemodelMeta(SimpleModel.BasemodelMeta):
description = 'Kehrbezirke der bevollmächtigten Bezirksschornsteinfeger ' \
'in der Hanse- und Universitätsstadt Rostock'
address_search_long_results = True
address_type = 'Adresse'
address_mandatory = True
list_fields = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,10 @@ function showAddressSearchResults(json, addressType, searchField, addressUuidFie
gemeinde = item.properties.gemeinde_name;
gemeinde += ', ';
}
titel = gemeinde + item.properties.gemeindeteil_name + ', ' + titel + ', ' + item.properties.postleitzahl;
let appendix = '';
if (addressType === 'Adresse')
appendix = ', ' + item.properties.postleitzahl;
titel = gemeinde + item.properties.gemeindeteil_name + ', ' + titel + appendix;
}
let result = '';
// if model provides address reference...
Expand Down
10 changes: 8 additions & 2 deletions datenmanagement/views/views_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,15 @@ def get_initial(self):
# add the appropriate initial field value for address, street or district to the dictionary
field_name_for_address_type = get_field_name_for_address_type(self.model)
if field_name_for_address_type == 'adresse' and self.object.adresse:
curr_dict[field_name_for_address_type] = self.object.adresse
if self.model.BasemodelMeta.address_search_long_results:
curr_dict[field_name_for_address_type] = self.object.adresse.adresse_lang
else:
curr_dict[field_name_for_address_type] = self.object.adresse
elif field_name_for_address_type == 'strasse' and self.object.strasse:
curr_dict[field_name_for_address_type] = self.object.strasse
if self.model.BasemodelMeta.address_search_long_results:
curr_dict[field_name_for_address_type] = self.object.strasse.strasse_lang
else:
curr_dict[field_name_for_address_type] = self.object.strasse
elif field_name_for_address_type == 'gemeindeteil' and self.object.gemeindeteil:
curr_dict[field_name_for_address_type] = self.object.gemeindeteil
for field in self.model._meta.get_fields():
Expand Down

0 comments on commit b15d6d7

Please sign in to comment.