Ticket #25954: arrayfield_set_model_on_nested_arrayfields.diff

File arrayfield_set_model_on_nested_arrayfields.diff, 636 bytes (added by Karan Lyons, 9 years ago)

Patch: Recursively set base field’s model to support nested ArrayFields.

  • django/contrib/postgres/fields/array.py

     
    3131
    3232    def contribute_to_class(self, cls, name, **kwargs):
    3333        super(ArrayField, self).contribute_to_class(cls, name, **kwargs)
     34        self._set_base_field_model(cls)
     35
     36    def _set_base_field_model(self, cls):
    3437        self.base_field.model = cls
     38        if isinstance(self.base_field, ArrayField):
     39            self.base_field._set_base_field_model(cls)
    3540
    3641    def check(self, **kwargs):
    3742        errors = super(ArrayField, self).check(**kwargs)
Back to Top