Compare commits

..

No commits in common. "93f31fbaa08e070ebd688e888225651f64c7f4ca" and "b05178da9a4f05087f05d8dac718305c5478fdf3" have entirely different histories.

1 changed files with 10 additions and 9 deletions

View File

@ -81,15 +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():
# # 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 values in data dictionary with keys from *_CHOICES if present there # update data with keys from *_CHOICES if present there
choices = {**DEPARTMENT_CHOICES, **LAPTOP_CHOICES, **TRANSPONDER_CHOICES, data.update({k:TRANSPONDER_CHOICES[v] for k,v in data.items() \
**OS_CHOICES, **MOBILE_CHOICES, **LANG_CHOICES,}
data.update({k:choices[v] for k,v in data.items() \
if isinstance(v,collections.abc.Hashable) \ if isinstance(v,collections.abc.Hashable) \
and v in choices}) and v in TRANSPONDER_CHOICES})
# replace keys in data dictionary with verbose_name return data
newdata = {self.instance._meta.get_field(k).verbose_name.title() : v for k,v in data.items()}
return newdata