Ticket #25953: arrayfield_condtionally_add_from_db_value.diff
File arrayfield_condtionally_add_from_db_value.diff, 878 bytes (added by , 9 years ago) |
---|
-
django/contrib/postgres/fields/array.py
28 28 self.default_validators = self.default_validators[:] 29 29 self.default_validators.append(ArrayMaxLengthValidator(self.size)) 30 30 super(ArrayField, self).__init__(**kwargs) 31 if hasattr(self.base_field, 'from_db_value'): 32 import types 33 def from_db_value(self, value, expression, connection, context): 34 return [self.base_field.from_db_value(i, expression, connection, context) for i in value] 35 36 self.from_db_value = types.MethodType(from_db_value, self) 31 37 32 38 def contribute_to_class(self, cls, name, **kwargs): 33 39 super(ArrayField, self).contribute_to_class(cls, name, **kwargs)