Skip to content

Commit

Permalink
[Fixes GeoNode#12170] unable to set advanced contact roles in metadat…
Browse files Browse the repository at this point in the history
…a editor
  • Loading branch information
mwallschlaeger committed Apr 23, 2024
1 parent 1a190bb commit 739b8d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1940,8 +1940,7 @@ def set_contact_roles_from_metadata_edit(self, resource_base_form) -> bool:
failed = False
for role in self.get_multivalue_role_property_names():
try:
if resource_base_form.cleaned_data[role].exists():
self.__setattr__(role, resource_base_form.cleaned_data[role])
self.__setattr__(role, resource_base_form.cleaned_data[role])
except AttributeError:
logger.warning(f"unable to set contact role {role} for {self} ...")
failed = True
Expand Down
13 changes: 7 additions & 6 deletions geonode/base/widgets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import List

from dal_select2_taggit.widgets import TaggitSelect2
from django.http.request import QueryDict


class TaggitSelect2Custom(TaggitSelect2):
Expand Down Expand Up @@ -32,9 +33,9 @@ def value_from_datadict(self, data, files, name) -> List[str]:
returns list of selected elements
"""
try:
ret_list = data.getlist(name)
except KeyError:
ret_list = []
finally:
return ret_list
if type(data) is dict and "name" in data:
return data["name"]
elif type(data) is QueryDict:
print("QUERYDICT")
return data.getlist(name)
return []

0 comments on commit 739b8d2

Please sign in to comment.