beautifyed beautify_data()
This commit is contained in:
parent
b6970cdf04
commit
b05178da9a
|
@ -81,10 +81,16 @@ class EvaFormView(CookieWizardView):
|
||||||
# This implementation works only for unique keys over all of these dicts from model.py
|
# This implementation works only for unique keys over all of these dicts from model.py
|
||||||
#
|
#
|
||||||
def beautify_data(self, data):
|
def beautify_data(self, data):
|
||||||
for k, v in data.items():
|
# for k, v in data.items():
|
||||||
# print(f"v: {v}")
|
# # print(f"v: {v}")
|
||||||
if isinstance(v,collections.Hashable):
|
# if isinstance(v,collections.Hashable):
|
||||||
if v in TRANSPONDER_CHOICES.keys():
|
# if v in TRANSPONDER_CHOICES.keys():
|
||||||
print(f"found {v} in TRANSPONDER_CHOICES")
|
# print(f"found {v} in TRANSPONDER_CHOICES")
|
||||||
data.update({k : TRANSPONDER_CHOICES[v]})
|
# 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
|
return data
|
||||||
|
|
Loading…
Reference in New Issue