chol
/
eva
forked from tohe/eva
1
0
Fork 0

beautifyed beautify_data()

This commit is contained in:
Benni Bärmann 2021-01-18 10:41:29 +01:00
parent b6970cdf04
commit b05178da9a
1 changed files with 12 additions and 6 deletions

View File

@ -81,10 +81,16 @@ class EvaFormView(CookieWizardView):
# This implementation works only for unique keys over all of these dicts from model.py
#
def beautify_data(self, data):
for k, v in data.items():
# print(f"v: {v}")
if isinstance(v,collections.Hashable):
if v in TRANSPONDER_CHOICES.keys():
print(f"found {v} in TRANSPONDER_CHOICES")
data.update({k : TRANSPONDER_CHOICES[v]})
# for k, v in data.items():
# # print(f"v: {v}")
# if isinstance(v,collections.Hashable):
# if v in TRANSPONDER_CHOICES.keys():
# print(f"found {v} in TRANSPONDER_CHOICES")
# data.update({k : TRANSPONDER_CHOICES[v]})
# update data with keys from *_CHOICES if present there
data.update({k:TRANSPONDER_CHOICES[v] for k,v in data.items() \
if isinstance(v,collections.abc.Hashable) \
and v in TRANSPONDER_CHOICES})
return data