diff --git a/wcs/fields.py b/wcs/fields.py index 218d27a37..7695d1dd2 100644 --- a/wcs/fields.py +++ b/wcs/fields.py @@ -486,6 +486,12 @@ class Field: return None return data.get('%s_structured' % self.id) + def get_prefill_configuration(self): + if self.prefill and self.prefill.get('type') == 'none': + # make sure a 'none' prefill is not considered as a value + self.prefill = None + return self.prefill or {} + def get_prefill_value(self, user=None, force_string=True): # returns a tuple with two items, # 1. value[str], the value that will be used to prefill @@ -564,7 +570,7 @@ class Field: return (None, False) def get_prefill_attributes(self): - if not self.prefill: + if not self.get_prefill_configuration(): return t = self.prefill.get('type') @@ -747,8 +753,8 @@ class Field: return str(value) def get_prefill_parameter_view_value(self, widget): - value = getattr(self, 'prefill', None) - if not value or value.get('type') == 'none': + value = self.get_prefill_configuration() + if not value: return r = TemplateIO(html=True) r += htmltext('